s4:s3compat push lp_server_role() into s3compat
authorAndrew Bartlett <abartlet@samba.org>
Mon, 17 May 2010 11:02:32 +0000 (21:02 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 3 Jun 2010 01:14:11 +0000 (11:14 +1000)
source4/s3compat/s3compat_globals.c
source4/s3compat/s3compat_names.c

index dd80712fc03bcce6a935a75c702711ab080d77c9..a926f2c368bf5c2ebd4c4803cfbc710176bbe27b 100644 (file)
@@ -7,6 +7,7 @@
 #include "s3compat_proto.h"
 #include "smbd/service.h"
 #include "lib/socket/socket.h"
+#include "librpc/gen_ndr/samr.h"
 
 static struct stream_connection *samba3_conn;
 
@@ -79,6 +80,7 @@ struct tevent_context *winbind_event_context(void)
        return s3compat_get_tevent_ctx();
 }
 
+/* Ensure that the most vital smb.conf options are in sync, or we will go mad! */
 const char *s3compat_lp_netbios_name(void)
 {
        return lp_netbios_name(s3compat_get_lp_ctx());
@@ -94,3 +96,18 @@ const char *s3compat_lp_sam_name(void)
        return lp_sam_name(s3compat_get_lp_ctx());
 }
 
+/* By both design and coincidence the source3 code uses enum samr_Role for this parameter */
+int s3compat_server_role(void)
+{
+       switch (lp_server_role(s3compat_get_lp_ctx())) {
+       case ROLE_DOMAIN_MEMBER:
+               return SAMR_ROLE_DOMAIN_MEMBER;
+       case ROLE_DOMAIN_CONTROLLER:
+               /* For now, never pretend to be the PDC emulator in the s3compat code */
+               return SAMR_ROLE_DOMAIN_BDC;
+       case ROLE_STANDALONE:
+       default:
+               return SAMR_ROLE_STANDALONE;
+       }
+}
+
index ee6c3042f6bdf7daa4a5f2f934393289541d2bd7..339a07082fd8d8e4674c6f257a88da0a987d5b65 100644 (file)
@@ -44,6 +44,17 @@ const char *get_global_sam_name(void)
        return s3compat_lp_sam_name();
 }
 
+int lp_server_role(void)
+{
+       return s3compat_server_role();
+}
+
+void set_server_role(void)
+{
+       /* This is ignored, the only way to set the server role is by the source4/ loadparm */
+       return;
+}
+
 /* Nothing do do here - we don't store these in globals */
 void gfree_netbios_names(void)
 {