s4:s3compat provide hooks for lp_workgroup() etc in s3compat
authorAndrew Bartlett <abartlet@samba.org>
Mon, 17 May 2010 09:11:24 +0000 (19:11 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 3 Jun 2010 01:14:10 +0000 (11:14 +1000)
These functions are key to maintaining a consistant view of the
binary, and it was practical to seperate them from the source3
loadparm.  This helps the s3compat winbind effort.

Andrew Bartlett

source4/s3compat/s3_winbind.c
source4/s3compat/s3compat_authenticate.c
source4/s3compat/s3compat_globals.c
source4/s3compat/s3compat_globals.h
source4/s3compat/s3compat_names.c [new file with mode: 0644]
source4/s3compat/wscript_build
source4/smbd/server.c

index ad90272e70a0fba2617a1988da3340ba9f220540..3321d51046f02178c9922e86241d7eb7a4ebeb4b 100644 (file)
@@ -24,9 +24,9 @@
 #include "winbind/wb_server.h"
 #include "smbd/service_task.h"
 #include "smbd/process_model.h"
+#include "param/param.h"
 
 #include "s3compat.h"
-#include "s3replace.h"
 #include "s3compat_globals.h"
 #include "s3compat_wrapper.h"
 
index 20df94c33cd2f51966c99ceb2e94364fcc39980b..380cfdef8b628b9f482f342058bbc2b413df92cb 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "auth/auth.h"
 #include "auth/auth_sam_reply.h"
+#include "param/param.h"
 #include "s3compat.h"
 #include "s3compat_globals.h"
 #include "s3compat_authenticate.h"
index b4715548663e9895c94caf934257a2d9be43fffa..dd80712fc03bcce6a935a75c702711ab080d77c9 100644 (file)
@@ -2,6 +2,7 @@
  * side that cannot be passed around as parameters */
 
 #include "includes.h"
+#include "param/param.h"
 #include "s3compat_globals.h"
 #include "s3compat_proto.h"
 #include "smbd/service.h"
@@ -77,3 +78,19 @@ struct tevent_context *winbind_event_context(void)
 {
        return s3compat_get_tevent_ctx();
 }
+
+const char *s3compat_lp_netbios_name(void)
+{
+       return lp_netbios_name(s3compat_get_lp_ctx());
+}
+
+const char *s3compat_lp_workgroup(void)
+{
+       return lp_workgroup(s3compat_get_lp_ctx());
+}
+
+const char *s3compat_lp_sam_name(void)
+{
+       return lp_sam_name(s3compat_get_lp_ctx());
+}
+
index 57db8da74da05982d7eda91d9d4e47fc011af654..088f4d45fd4bcf418cf69160ef691a2b66b803ac 100644 (file)
@@ -1,3 +1,3 @@
-#include "lib/messaging/messaging.h"
-#include "param/param.h"
+struct loadparm_context;
+struct messaging_context;
 #include "s3compat_globals_proto.h"
diff --git a/source4/s3compat/s3compat_names.c b/source4/s3compat/s3compat_names.c
new file mode 100644 (file)
index 0000000..ee6c304
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+   Unix SMB/CIFS implementation.
+   Connect lp_workgroup() and global_myname() across s3compat
+   Copyright (C) Andrew Bartlett 2010
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "s3compat_globals.h"
+bool set_global_myname(const char *myname)
+{
+       /* This is ignored, the only way to set global_myname is by the source4/ loadparm */
+       return true;
+}
+const char *global_myname(void)
+{
+       return s3compat_lp_netbios_name();
+}
+bool set_global_myworkgroup(const char *myworkgroup)
+{
+       /* This is ignored, the only way to set global_myname is by the source4/ loadparm */
+       return true;
+}
+       
+const char *lp_workgroup(void)
+{
+       return s3compat_lp_workgroup();
+}
+
+const char *get_global_sam_name(void)
+{
+       return s3compat_lp_sam_name();
+}
+
+/* Nothing do do here - we don't store these in globals */
+void gfree_netbios_names(void)
+{
+       return;
+}
index 44299b0314f182db3b53aaaa6e290e9be287f420..0eb3d4efe082a268ecbb638f2928e9df6d40936c 100644 (file)
@@ -880,7 +880,7 @@ bld.SAMBA_SUBSYSTEM('s3compat_wrapper',
                     hide_symbols=True)
 
 bld.SAMBA_SUBSYSTEM('s3replace',
-                    source='s3replace.c',
+                    source='s3replace.c s3compat_names.c',
                     autoproto='s3replace.h',
                     includes=SAMBA3_INCLUDES,
                     deps='talloc tevent tdb',
index 83ce2c5ce921b356f10796d07a196b1a6bff9bea..68804e0ce09e91e9b4cfecaa1f95ec2d80369284 100644 (file)
@@ -436,6 +436,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
        s4_event_context_set_default(event_ctx);
 
 #ifdef ENABLE_S3COMPAT
+       s3compat_set_lp_ctx(cmdline_lp_ctx);
        s3compat_set_tevent_ctx(event_ctx);
        s3compat_initialise(lp_configfile(cmdline_lp_ctx), opt_interactive);
 #endif