summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-16 16:40:59 +0100
committerMichael Adam <obnox@samba.org>2008-01-16 17:10:02 +0100
commitb92c3e281c66127dbd2b16b7c71e2cba4e0c1de9 (patch)
tree287b29cfcefac7ea588575103098076ec2c4751f /source3
parent89b1c68b37dd5f020982de82ba6ef9790986d8c7 (diff)
downloadsamba-b92c3e281c66127dbd2b16b7c71e2cba4e0c1de9.tar.gz
samba-b92c3e281c66127dbd2b16b7c71e2cba4e0c1de9.tar.bz2
samba-b92c3e281c66127dbd2b16b7c71e2cba4e0c1de9.zip
Add handling of [homes] and [printers] via registry shares.
Now homes and printers shares can be accessed through the registry meachanism on demand in pure registry configurations with "config backend = registry" without the need to have a special handler for these two. Michael (This used to be commit eec3248ef90fbfe6e048394c875173b164a8b439)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/service.c84
1 files changed, 45 insertions, 39 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 2588a66b8b..ed8061e2f7 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -219,44 +219,6 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir)
return(True);
}
-/****************************************************************************
- Add a home service. Returns the new service number or -1 if fail.
-****************************************************************************/
-
-int add_home_service(const char *service, const char *username, const char *homedir)
-{
- int iHomeService;
-
- if (!service || !homedir)
- return -1;
-
- if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0)
- return -1;
-
- /*
- * If this is a winbindd provided username, remove
- * the domain component before adding the service.
- * Log a warning if the "path=" parameter does not
- * include any macros.
- */
-
- {
- const char *p = strchr(service,*lp_winbind_separator());
-
- /* We only want the 'user' part of the string */
- if (p) {
- service = p + 1;
- }
- }
-
- if (!lp_add_home(service, iHomeService, username, homedir)) {
- return -1;
- }
-
- return lp_servicenumber(service);
-
-}
-
static int load_registry_service(const char *servicename)
{
struct registry_key *key;
@@ -348,6 +310,47 @@ void load_registry_shares(void)
return;
}
+/****************************************************************************
+ Add a home service. Returns the new service number or -1 if fail.
+****************************************************************************/
+
+int add_home_service(const char *service, const char *username, const char *homedir)
+{
+ int iHomeService;
+
+ if (!service || !homedir)
+ return -1;
+
+ if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) {
+ if ((iHomeService = load_registry_service(HOMES_NAME)) < 0) {
+ return -1;
+ }
+ }
+
+ /*
+ * If this is a winbindd provided username, remove
+ * the domain component before adding the service.
+ * Log a warning if the "path=" parameter does not
+ * include any macros.
+ */
+
+ {
+ const char *p = strchr(service,*lp_winbind_separator());
+
+ /* We only want the 'user' part of the string */
+ if (p) {
+ service = p + 1;
+ }
+ }
+
+ if (!lp_add_home(service, iHomeService, username, homedir)) {
+ return -1;
+ }
+
+ return lp_servicenumber(service);
+
+}
+
/**
* Find a service entry.
*
@@ -386,7 +389,10 @@ int find_service(fstring service)
if (iService < 0) {
int iPrinterService;
- if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) >= 0) {
+ if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) {
+ iPrinterService = load_registry_service(PRINTERS_NAME);
+ }
+ if (iPrinterService) {
DEBUG(3,("checking whether %s is a valid printer name...\n", service));
if (pcap_printername_ok(service)) {
DEBUG(3,("%s is a valid printer name\n", service));