[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-1669-gd5ebfcc
Günther Deschner
gd at samba.org
Fri Jan 25 14:33:16 GMT 2008
The branch, v3-2-test has been updated
via d5ebfccebb1f1b56b45673a506fcdb414103c43b (commit)
from 4b3d96be8017a38a6af4ce58ae54a6af005fbe3e (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit d5ebfccebb1f1b56b45673a506fcdb414103c43b
Author: Günther Deschner <gd at samba.org>
Date: Fri Jan 25 13:26:10 2008 +0100
Use generated DSSETUP client & server rpc functions and remove the hand-written ones.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/Makefile.in | 10 +-
source/configure.in | 4 +-
source/include/rpc_client.h | 1 +
source/include/rpc_ds.h | 66 -----------
source/include/smb.h | 3 +-
source/rpc_client/cli_ds.c | 42 -------
source/rpc_client/cli_pipe.c | 2 +-
source/rpc_parse/parse_ds.c | 111 ------------------
source/rpc_server/srv_dssetup_nt.c | 220 ++++++++++++++++++++++++++++++++++++
source/rpc_server/srv_lsa_ds.c | 85 --------------
source/rpc_server/srv_lsa_ds_nt.c | 130 ---------------------
source/rpc_server/srv_pipe.c | 4 +-
source/rpcclient/cmd_ds.c | 51 +++++----
source/winbindd/winbindd_cm.c | 31 +++---
14 files changed, 281 insertions(+), 479 deletions(-)
create mode 100644 source/rpc_server/srv_dssetup_nt.c
delete mode 100644 source/rpc_server/srv_lsa_ds.c
delete mode 100644 source/rpc_server/srv_lsa_ds_nt.c
Changeset truncated at 500 lines:
diff --git a/source/Makefile.in b/source/Makefile.in
index e30d13e..08a0c14 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -276,6 +276,7 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \
librpc/gen_ndr/ndr_eventlog.o \
librpc/gen_ndr/ndr_netlogon.o \
librpc/gen_ndr/ndr_samr.o \
+ librpc/gen_ndr/ndr_dssetup.o \
librpc/gen_ndr/ndr_notify.o \
librpc/gen_ndr/ndr_xattr.o \
librpc/gen_ndr/ndr_libnet_join.o
@@ -409,6 +410,7 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
librpc/gen_ndr/cli_wkssvc.o \
librpc/gen_ndr/cli_netlogon.o \
librpc/gen_ndr/cli_samr.o \
+ librpc/gen_ndr/cli_dssetup.o \
$(LIBNDR_GEN_OBJ) \
$(RPCCLIENT_NDR_OBJ)
@@ -474,7 +476,7 @@ RPC_REG_OBJ = rpc_server/srv_winreg_nt.o \
librpc/gen_ndr/srv_winreg.o \
$(REGFIO_OBJ)
-RPC_LSA_DS_OBJ = rpc_server/srv_lsa_ds.o rpc_server/srv_lsa_ds_nt.o
+RPC_DSSETUP_OBJ = rpc_server/srv_dssetup_nt.o librpc/gen_ndr/srv_dssetup.o
RPC_SVC_OBJ = rpc_server/srv_srvsvc.o rpc_server/srv_srvsvc_nt.o \
librpc/gen_ndr/srv_srvsvc.o
@@ -900,7 +902,7 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) $(LIBNDR_OBJ) $(LIBNDR_GEN_OBJ) \
$(PASSDB_OBJ) $(GROUPDB_OBJ) \
$(READLINE_OBJ) $(PROFILE_OBJ) $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \
$(AUTH_SAM_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \
- $(RPC_LSA_OBJ) $(RPC_NETLOG_OBJ) $(RPC_SAMR_OBJ) $(RPC_REG_OBJ) $(RPC_LSA_DS_OBJ) \
+ $(RPC_LSA_OBJ) $(RPC_NETLOG_OBJ) $(RPC_SAMR_OBJ) $(RPC_REG_OBJ) $(RPC_DSSETUP_OBJ) \
$(RPC_SVC_OBJ) $(RPC_WKS_OBJ) $(RPC_DFS_OBJ) $(RPC_SPOOLSS_OBJ) \
$(RPC_ECHO_OBJ) $(RPC_SVCCTL_OBJ) $(RPC_EVENTLOG_OBJ) $(SMBLDAP_OBJ) \
$(IDMAP_OBJ) libsmb/spnego.o $(PASSCHANGE_OBJ) $(RPC_UNIXINFO_OBJ) \
@@ -1543,9 +1545,9 @@ bin/librpc_initshutdown. at SHLIBEXT@: $(BINARY_PREREQS) $(RPC_INITSHUTDOWN_OBJ)
@echo "Linking $@"
@$(SHLD_MODULE) $(RPC_INITSHUTDOWN_OBJ)
-bin/librpc_lsa_ds. at SHLIBEXT@: $(BINARY_PREREQS) $(RPC_LSA_DS_OBJ)
+bin/librpc_dssetup. at SHLIBEXT@: $(BINARY_PREREQS) $(RPC_DSSETUP_OBJ)
@echo "Linking $@"
- @$(SHLD_MODULE) $(RPC_LSA_DS_OBJ)
+ @$(SHLD_MODULE) $(RPC_DSSETUP_OBJ)
bin/librpc_spoolss. at SHLIBEXT@: $(BINARY_PREREQS) $(RPC_SPOOLSS_OBJ)
@echo "Linking $@"
diff --git a/source/configure.in b/source/configure.in
index fcbe56f..7878cd9 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -704,7 +704,7 @@ AC_SUBST(DYNEXP)
dnl Add modules that have to be built by default here
dnl These have to be built static:
-default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
+default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
dnl These are preferably build shared, and static if dlopen() is not available
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb vfs_streams_xattr"
@@ -6434,7 +6434,7 @@ SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
SMB_MODULE(rpc_lsa, \$(RPC_LSA_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
SMB_MODULE(rpc_winreg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_lsa_ds, \$(RPC_LSA_DS_OBJ), "bin/librpc_lsa_ds.$SHLIBEXT", RPC)
+SMB_MODULE(rpc_dssetup, \$(RPC_DSSETUP_OBJ), "bin/librpc_dssetup.$SHLIBEXT", RPC)
SMB_MODULE(rpc_wkssvc, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
SMB_MODULE(rpc_svcctl2, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl2.$SHLIBEXT", RPC)
SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
diff --git a/source/include/rpc_client.h b/source/include/rpc_client.h
index 01e2a84..c560fd0 100644
--- a/source/include/rpc_client.h
+++ b/source/include/rpc_client.h
@@ -33,6 +33,7 @@
#include "librpc/gen_ndr/cli_srvsvc.h"
#include "librpc/gen_ndr/cli_samr.h"
#include "librpc/gen_ndr/cli_netlogon.h"
+#include "librpc/gen_ndr/cli_dssetup.h"
/* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */
diff --git a/source/include/rpc_ds.h b/source/include/rpc_ds.h
index 1ba02ae..0278b61 100644
--- a/source/include/rpc_ds.h
+++ b/source/include/rpc_ds.h
@@ -20,82 +20,16 @@
#ifndef _RPC_DS_H /* _RPC_LSA_H */
#define _RPC_DS_H
-/* Opcodes available on PIPE_LSARPC_DS */
-
-#define DS_GETPRIMDOMINFO 0x00
-#define DS_NOP 0xFF /* no op -- placeholder */
-
/* Opcodes available on PIPE_NETLOGON */
#define DS_ENUM_DOM_TRUSTS 0x28
-/* macros for RPC's */
-
-/* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */
-
-/* flags */
-
-#define DSROLE_PRIMARY_DS_RUNNING 0x00000001
-#define DSROLE_PRIMARY_DS_MIXED_MODE 0x00000002
-#define DSROLE_UPGRADE_IN_PROGRESS 0x00000004
-#define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT 0x01000000
-
-/* machine role */
-
-#define DSROLE_DOMAIN_MEMBER_WKS 1
-#define DSROLE_STANDALONE_SRV 2
-#define DSROLE_DOMAIN_MEMBER_SRV 3
-#define DSROLE_BDC 4
-#define DSROLE_PDC 5
-
/* Settings for the domainFunctionality attribute in the rootDSE */
#define DS_DOMAIN_FUNCTION_2000 0
#define DS_DOMAIN_FUCNTION_2003_MIXED 1
#define DS_DOMAIN_FUNCTION_2003 2
-typedef struct
-{
- uint16 machine_role;
- uint32 flags;
- uint32 netbios_ptr;
- uint32 dnsname_ptr;
- uint32 forestname_ptr;
-
- struct GUID domain_guid;
- UNISTR2 netbios_domain;
- UNISTR2 dns_domain; /* our dns domain */
- UNISTR2 forest_domain; /* root domain of the forest to which we belong */
-} DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
-
-typedef struct
-{
- DSROLE_PRIMARY_DOMAIN_INFO_BASIC *basic;
-} DS_DOMINFO_CTR;
-
-/* info levels for ds_getprimdominfo() */
-
-#define DsRolePrimaryDomainInfoBasic 1
-
-/* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */
-typedef struct
-{
- uint16 level;
-} DS_Q_GETPRIMDOMINFO;
-
-/* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */
-typedef struct
-{
- uint32 ptr;
-
- uint16 level;
- uint16 unknown0; /* 0x455c -- maybe just alignment? */
-
- DS_DOMINFO_CTR info;
-
- NTSTATUS status;
-} DS_R_GETPRIMDOMINFO;
-
typedef struct {
/* static portion of structure */
uint32 netbios_ptr;
diff --git a/source/include/smb.h b/source/include/smb.h
index 3160365..3e0c997 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -193,7 +193,7 @@ typedef uint32 codepoint_t;
#define PIPE_NETLOGON_PLAIN "\\NETLOGON"
#define PI_LSARPC 0
-#define PI_LSARPC_DS 1
+#define PI_DSSETUP 1
#define PI_SAMR 2
#define PI_NETLOGON 3
#define PI_SRVSVC 4
@@ -306,6 +306,7 @@ extern const DATA_BLOB data_blob_null;
#include "librpc/gen_ndr/svcctl.h"
#include "librpc/gen_ndr/netlogon.h"
#include "librpc/gen_ndr/samr.h"
+#include "librpc/gen_ndr/dssetup.h"
#include "librpc/gen_ndr/libnet_join.h"
struct lsa_dom_info {
diff --git a/source/rpc_client/cli_ds.c b/source/rpc_client/cli_ds.c
index 71516b8..c9724de 100644
--- a/source/rpc_client/cli_ds.c
+++ b/source/rpc_client/cli_ds.c
@@ -23,48 +23,6 @@
/* implementations of client side DsXXX() functions */
/********************************************************************
- Get information about the server and directory services
-********************************************************************/
-
-NTSTATUS rpccli_ds_getprimarydominfo(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- uint16 level, DS_DOMINFO_CTR *ctr)
-{
- prs_struct qbuf, rbuf;
- DS_Q_GETPRIMDOMINFO q;
- DS_R_GETPRIMDOMINFO r;
- NTSTATUS result;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- q.level = level;
-
- CLI_DO_RPC( cli, mem_ctx, PI_LSARPC_DS, DS_GETPRIMDOMINFO,
- q, r,
- qbuf, rbuf,
- ds_io_q_getprimdominfo,
- ds_io_r_getprimdominfo,
- NT_STATUS_UNSUCCESSFUL);
-
- /* Return basic info - if we are requesting at info != 1 then
- there could be trouble. */
-
- result = r.status;
-
- if ( r.ptr && ctr ) {
- ctr->basic = TALLOC_P(mem_ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC);
- if (!ctr->basic)
- goto done;
- memcpy(ctr->basic, r.info.basic, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
- }
-
-done:
-
- return result;
-}
-
-/********************************************************************
Enumerate trusted domains in an AD forest
********************************************************************/
diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index 81b2ea5..40d0ac5 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -2263,7 +2263,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe
*perr = rpc_pipe_bind(result, PIPE_AUTH_TYPE_NONE, PIPE_AUTH_LEVEL_NONE);
if (!NT_STATUS_IS_OK(*perr)) {
int lvl = 0;
- if (pipe_idx == PI_LSARPC_DS) {
+ if (pipe_idx == PI_DSSETUP) {
/* non AD domains just don't have this pipe, avoid
* level 0 statement in that case - gd */
lvl = 3;
diff --git a/source/rpc_parse/parse_ds.c b/source/rpc_parse/parse_ds.c
index 8f3ce36..3cf4156 100644
--- a/source/rpc_parse/parse_ds.c
+++ b/source/rpc_parse/parse_ds.c
@@ -21,117 +21,6 @@
#include "includes.h"
/************************************************************************
-************************************************************************/
-
-static bool ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic, prs_struct *ps, int depth)
-{
- DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic;
-
- if ( UNMARSHALLING(ps) ) {
- p = *basic = PRS_ALLOC_MEM(ps, DSROLE_PRIMARY_DOMAIN_INFO_BASIC, 1);
- }
-
- if ( !p )
- return False;
-
- if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("flags", ps, depth, &p->flags) )
- return False;
-
- if ( !prs_uint32("netbios_ptr", ps, depth, &p->netbios_ptr) )
- return False;
- if ( !prs_uint32("dnsname_ptr", ps, depth, &p->dnsname_ptr) )
- return False;
- if ( !prs_uint32("forestname_ptr", ps, depth, &p->forestname_ptr) )
- return False;
-
- if ( !smb_io_uuid("domain_guid", &p->domain_guid, ps, depth) )
- return False;
-
- if ( !smb_io_unistr2( "netbios_domain", &p->netbios_domain, p->netbios_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !smb_io_unistr2( "dns_domain", &p->dns_domain, p->dnsname_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !smb_io_unistr2( "forest_domain", &p->forest_domain, p->forestname_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
-
- return True;
-
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_q_getprimdominfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint16( "level", ps, depth, &q_u->level ) )
- return False;
-
- return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_r_getprimdominfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint32( "ptr", ps, depth, &r_u->ptr ) )
- return False;
-
- if ( r_u->ptr )
- {
- if ( !prs_uint16( "level", ps, depth, &r_u->level ) )
- return False;
-
- if ( !prs_uint16( "unknown0", ps, depth, &r_u->unknown0 ) )
- return False;
-
- switch ( r_u->level )
- {
- case DsRolePrimaryDomainInfoBasic:
- if ( !ds_io_dominfobasic( "dominfobasic", &r_u->info.basic, ps, depth) )
- return False;
- break;
- default:
- return False;
- }
- }
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_ntstatus("status", ps, depth, &r_u->status ) )
- return False;
-
- return True;
-}
-
-/************************************************************************
initialize a DS_ENUM_DOM_TRUSTS structure
************************************************************************/
diff --git a/source/rpc_server/srv_dssetup_nt.c b/source/rpc_server/srv_dssetup_nt.c
new file mode 100644
index 0000000..ea535a3
--- /dev/null
+++ b/source/rpc_server/srv_dssetup_nt.c
@@ -0,0 +1,220 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * RPC Pipe client / server routines
+ * Copyright (C) Andrew Tridgell 1992-1997.
+ * Copyright (C) Luke Kenneth Casson Leighton 1996-1997.
+ * Copyright (C) Paul Ashton 1997.
+ * Copyright (C) Jeremy Allison 2001.
+ * Copyright (C) Gerald Carter 2002.
+ * Copyright (C) Guenther Deschner 2008.
+ *
+ * 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"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_SRV
+
+/********************************************************************
+ Fill in a dssetup_DsRolePrimaryDomInfoBasic structure
+ ********************************************************************/
+
+static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx,
+ struct dssetup_DsRolePrimaryDomInfoBasic **info)
+{
+ struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
+ fstring dnsdomain;
+
+ DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
+
+ basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic);
+ if (!basic) {
+ DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n"));
+ return WERR_NOMEM;
+ }
+
+ switch (lp_server_role()) {
+ case ROLE_STANDALONE:
+ basic->role = DS_ROLE_STANDALONE_SERVER;
+ basic->domain = get_global_sam_name();
+ break;
+ case ROLE_DOMAIN_MEMBER:
+ basic->role = DS_ROLE_MEMBER_SERVER;
+ basic->domain = lp_workgroup();
+ break;
+ case ROLE_DOMAIN_BDC:
+ basic->role = DS_ROLE_BACKUP_DC;
+ basic->domain = get_global_sam_name();
+ break;
+ case ROLE_DOMAIN_PDC:
+ basic->role = DS_ROLE_PRIMARY_DC;
+ basic->domain = get_global_sam_name();
+ break;
+ }
+
+ if (secrets_fetch_domain_guid(lp_workgroup(), &basic->domain_guid)) {
+ basic->flags |= DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT;
+ }
+
+ /* fill in some additional fields if we are a member of an AD domain */
+
+ if (lp_security() == SEC_ADS) {
+ fstrcpy(dnsdomain, lp_realm());
+ strlower_m(dnsdomain);
+ basic->dns_domain = dnsdomain;
+
+ /* FIXME!! We really should fill in the correct forest
+ name. Should get this information from winbindd. */
+ basic->forest = dnsdomain;
+ } else {
+ /* security = domain should not fill in the dns or
+ forest name */
+ basic->dns_domain = NULL;
+ basic->forest = NULL;
+ }
+
+ *info = basic;
+
+ return WERR_OK;
+}
+
+/********************************************************************
+ Implement the _dssetup_DsRoleGetPrimaryDomainInformation() call
+ ********************************************************************/
+
+WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p,
+ struct dssetup_DsRoleGetPrimaryDomainInformation *r)
+{
+ WERROR werr = WERR_OK;
+
+ switch (r->in.level) {
+
+ case DS_ROLE_BASIC_INFORMATION: {
+ struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
+ werr = fill_dsrole_dominfo_basic(p->mem_ctx, &basic);
+ if (W_ERROR_IS_OK(werr)) {
+ r->out.info->basic = *basic;
+ }
+ break;
+ }
+ default:
+ DEBUG(0,("_dssetup_DsRoleGetPrimaryDomainInformation: "
+ "Unknown info level [%d]!\n", r->in.level));
--
Samba Shared Repository
More information about the samba-cvs
mailing list