diff options
Diffstat (limited to 'source3')
94 files changed, 5955 insertions, 3186 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index c519ff8985..08a0c14311 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -257,6 +257,7 @@ LIBNDR_OBJ = librpc/ndr/ndr_basic.o \ librpc/ndr/ndr.o \ librpc/ndr/ndr_misc.o \ librpc/gen_ndr/ndr_misc.o \ + librpc/gen_ndr/ndr_security.o \ librpc/ndr/ndr_sec_helper.o \ librpc/ndr/ndr_string.o \ librpc/ndr/sid.o \ @@ -275,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 @@ -408,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) @@ -473,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 @@ -899,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) \ @@ -943,6 +946,7 @@ WINBINDD_OBJ1 = \ winbindd/winbindd_domain.o \ winbindd/winbindd_idmap.o \ winbindd/winbindd_locator.o \ + winbindd/winbindd_ndr.o \ auth/token_util.o WINBINDD_OBJ = \ @@ -1091,7 +1095,8 @@ modules: SHOWFLAGS $(MODULES) ## Perl IDL Compiler IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl \ srvsvc.idl svcctl.idl eventlog.idl wkssvc.idl netlogon.idl notify.idl \ - epmapper.idl messaging.idl xattr.idl misc.idl samr.idl + epmapper.idl messaging.idl xattr.idl misc.idl samr.idl security.idl \ + dssetup.idl idl: @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \ @@ -1540,9 +1545,9 @@ bin/librpc_initshutdown.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_INITSHUTDOWN_OBJ) @echo "Linking $@" @$(SHLD_MODULE) $(RPC_INITSHUTDOWN_OBJ) -bin/librpc_lsa_ds.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_LSA_DS_OBJ) +bin/librpc_dssetup.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_DSSETUP_OBJ) @echo "Linking $@" - @$(SHLD_MODULE) $(RPC_LSA_DS_OBJ) + @$(SHLD_MODULE) $(RPC_DSSETUP_OBJ) bin/librpc_spoolss.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_SPOOLSS_OBJ) @echo "Linking $@" diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 816e7b1710..04cc987889 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -1471,8 +1471,10 @@ int cmd_tar(void) } argl=toktocliplist(&argcl, NULL); - if (!tar_parseargs(argcl, argl, buf, 0)) + if (!tar_parseargs(argcl, argl, buf, 0)) { + SAFE_FREE(argl); return 1; + } ret = process_tar(); SAFE_FREE(argl); diff --git a/source3/client/smbmnt.c b/source3/client/smbmnt.c index 79c55b2f90..198faca173 100644 --- a/source3/client/smbmnt.c +++ b/source3/client/smbmnt.c @@ -162,7 +162,7 @@ do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data) char *release, *major, *minor; char *data1, *data2; int ret; - char *saveptr; + char *saveptr = NULL; if (asprintf(&opts, "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s", diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 9fe2d36bd3..ee4b180a89 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -764,7 +764,7 @@ static void parse_mount_smb(int argc, char **argv) char *opts; char *opteq; int val; - char *saveptr; + char *saveptr = NULL; TALLOC_CTX *ctx = talloc_tos(); /* FIXME: This function can silently fail if the arguments are diff --git a/source3/configure.in b/source3/configure.in index fcbe56f268..7878cd96da 100644 --- a/source3/configure.in +++ b/source3/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/source3/include/doserr.h b/source3/include/doserr.h index 546d06926a..5794fbe71c 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -202,6 +202,7 @@ #define WERR_SERVICE_ALREADY_RUNNING W_ERROR(1056) #define WERR_SERVICE_DISABLED W_ERROR(1058) #define WERR_SERVICE_NEVER_STARTED W_ERROR(1077) +#define WERR_INVALID_COMPUTER_NAME W_ERROR(1210) #define WERR_MACHINE_LOCKED W_ERROR(1271) #define WERR_NO_LOGON_SERVERS W_ERROR(1311) #define WERR_NO_SUCH_LOGON_SESSION W_ERROR(1312) diff --git a/source3/include/messages.h b/source3/include/messages.h index 8de41ca049..c97ad982b3 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -97,6 +97,7 @@ #define MSG_WINBIND_TRY_TO_GO_ONLINE 0x0406 #define MSG_WINBIND_FAILED_TO_GO_ONLINE 0x0407 #define MSG_WINBIND_VALIDATE_CACHE 0x0408 +#define MSG_WINBIND_DUMP_DOMAIN_LIST 0x0409 /* event messages */ #define MSG_DUMP_EVENT_LIST 0x0500 diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 01e2a8421b..c560fd0909 100644 --- a/source3/include/rpc_client.h +++ b/source3/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/source3/include/rpc_ds.h b/source3/include/rpc_ds.h index 1ba02aede0..0278b61d89 100644 --- a/source3/include/rpc_ds.h +++ b/source3/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/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 72aabc310e..371c3ebd11 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -927,45 +927,6 @@ typedef struct lsa_r_removeprivs } LSA_R_REMOVEPRIVS; /*******************************************************/ -#if 0 /* jerry, I think this not correct - gd */ -typedef struct { - POLICY_HND handle; - uint32 count; /* ??? this is what ethereal calls it */ - DOM_SID sid; -} LSA_Q_OPEN_TRUSTED_DOMAIN; -#endif - -/* LSA_Q_OPEN_TRUSTED_DOMAIN - LSA Query Open Trusted Domain */ -typedef struct lsa_q_open_trusted_domain -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 sid; /* domain sid */ - uint32 access_mask; /* access mask */ - -} LSA_Q_OPEN_TRUSTED_DOMAIN; - -/* LSA_R_OPEN_TRUSTED_DOMAIN - response to LSA Query Open Trusted Domain */ -typedef struct { - POLICY_HND handle; /* trustdom policy handle */ - NTSTATUS status; /* return code */ -} LSA_R_OPEN_TRUSTED_DOMAIN; - - -/*******************************************************/ - -typedef struct { - POLICY_HND handle; - UNISTR4 secretname; - uint32 access; -} LSA_Q_OPEN_SECRET; - -typedef struct { - POLICY_HND handle; - NTSTATUS status; -} LSA_R_OPEN_SECRET; - - -/*******************************************************/ typedef struct { POLICY_HND handle; @@ -975,87 +936,4 @@ typedef struct { NTSTATUS status; } LSA_R_DELETE_OBJECT; - -/*******************************************************/ - -typedef struct { - POLICY_HND handle; - UNISTR4 secretname; - uint32 access; -} LSA_Q_CREATE_SECRET; - -typedef struct { - POLICY_HND handle; - NTSTATUS status; -} LSA_R_CREATE_SECRET; - - -/*******************************************************/ - -typedef struct { - POLICY_HND handle; - UNISTR4 secretname; - uint32 access; -} LSA_Q_CREATE_TRUSTED_DOMAIN; - -typedef struct { - POLICY_HND handle; - NTSTATUS status; -} LSA_R_CREATE_TRUSTED_DOMAIN; - - -/*******************************************************/ - -typedef struct { - uint32 size; /* size is written on the wire twice so I - can only assume that one is supposed to - be a max length and one is a size */ - UNISTR2 *data; /* not really a UNICODE string but the parsing - is the same */ -} LSA_DATA_BLOB; - -typedef struct { - POLICY_HND handle; - LSA_DATA_BLOB *old_value; - LSA_DATA_BLOB *new_value; -} LSA_Q_SET_SECRET; - -typedef struct { - NTSTATUS status; -} LSA_R_SET_SECRET; - -typedef struct dom_info_kerberos { - uint32 enforce_restrictions; - NTTIME service_tkt_lifetime; - NTTIME user_tkt_lifetime; - NTTIME user_tkt_renewaltime; - NTTIME clock_skew; - NTTIME unknown6; -} LSA_DOM_INFO_POLICY_KERBEROS; - -typedef struct dom_info_efs { - uint32 blob_len; - UNISTR2 efs_blob; -} LSA_DOM_INFO_POLICY_EFS; - -typedef struct lsa_dom_info_union { - uint16 info_class; - LSA_DOM_INFO_POLICY_EFS efs_policy; - LSA_DOM_INFO_POLICY_KERBEROS krb_policy; -} LSA_DOM_INFO_UNION; - -/* LSA_Q_QUERY_DOM_INFO_POLICY - LSA query info */ -typedef struct lsa_q_query_dom_info_policy -{ - POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ -} LSA_Q_QUERY_DOM_INFO_POLICY; - -typedef struct lsa_r_query_dom_info_policy -{ - LSA_DOM_INFO_UNION *info; - NTSTATUS status; -} LSA_R_QUERY_DOM_INFO_POLICY; - - #endif /* _RPC_LSA_H */ diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index 48a2a32bf6..244e37d85a 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -92,7 +92,6 @@ #if 0 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800 -#endif /* updates the "logon time" on network logon */ #define MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004 @@ -103,6 +102,7 @@ /* returns the profilepath in the driveletter and * sets LOGON_PROFILE_PATH_RETURNED user_flag */ #define MSV1_0_RETURN_PROFILE_PATH 0x00000200 +#endif #if 0 /* I think this is correct - it's what gets parsed on the wire. JRA. */ @@ -1096,41 +1096,6 @@ typedef struct net_r_dsr_getdcname { WERROR result; } NET_R_DSR_GETDCNAME; -/* NET_Q_DSR_GETDCNAMEEX */ -typedef struct net_q_dsr_getdcnameex { - uint32 ptr_server_unc; - UNISTR2 uni_server_unc; - uint32 ptr_domain_name; - UNISTR2 uni_domain_name; - uint32 ptr_domain_guid; - struct GUID *domain_guid; - uint32 ptr_site_name; - UNISTR2 uni_site_name; - uint32 flags; -} NET_Q_DSR_GETDCNAMEEX; - -/* NET_R_DSR_GETDCNAMEEX */ -typedef struct net_r_dsr_getdcnameex NET_R_DSR_GETDCNAMEEX; - -/* NET_Q_DSR_GETDCNAMEEX2 */ -typedef struct net_q_dsr_getdcnameex2 { - uint32 ptr_server_unc; - UNISTR2 uni_server_unc; - uint32 ptr_client_account; - UNISTR2 uni_client_account; - uint32 mask; - uint32 ptr_domain_name; - UNISTR2 uni_domain_name; - uint32 ptr_domain_guid; - struct GUID *domain_guid; - uint32 ptr_site_name; - UNISTR2 uni_site_name; - uint32 flags; -} NET_Q_DSR_GETDCNAMEEX2; - -/* NET_R_DSR_GETDCNAMEEX2 */ -typedef struct net_r_dsr_getdcnameex2 NET_R_DSR_GETDCNAMEEX2; - /* NET_Q_DSR_GESITENAME */ typedef struct net_q_dsr_getsitename { uint32 ptr_computer_name; diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 5ddb877b90..9f4645b691 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -145,31 +145,6 @@ SamrTestPrivateFunctionsUser #define SAMR_CHGPASSWD_USER3 0x3F #define SAMR_CONNECT5 0x40 -/* SAMR account creation flags/permissions */ -#define SAMR_USER_GETNAME 0x1 -#define SAMR_USER_GETLOCALE 0x2 -#define SAMR_USER_GETLOCCOM 0x4 -#define SAMR_USER_GETLOGONINFO 0x8 -#define SAMR_USER_GETATTR 0x10 -#define SAMR_USER_SETATTR 0x20 -#define SAMR_USER_CHPASS 0x40 -#define SAMR_USER_SETPASS 0x80 -#define SAMR_USER_GETGROUPS 0x100 -#define SAMR_USER_GETMEMBERSHIP 0x200 -#define SAMR_USER_CHMEMBERSHIP 0x400 -#define SAMR_STANDARD_DELETE 0x10000 -#define SAMR_STANDARD_READCTRL 0x20000 -#define SAMR_STANDARD_WRITEDAC 0x40000 -#define SAMR_STANDARD_WRITEOWNER 0x80000 -#define SAMR_STANDARD_SYNC 0x100000 -#define SAMR_GENERIC_ACCESSSACL 0x800000 -#define SAMR_GENERIC_MAXALLOWED 0x2000000 -#define SAMR_GENERIC_ALL 0x10000000 -#define SAMR_GENERIC_EXECUTE 0x20000000 -#define SAMR_GENERIC_WRITE 0x40000000 -#define SAMR_GENERIC_READ 0x80000000 - - typedef struct logon_hours_info { uint32 max_len; /* normally 1260 bytes */ diff --git a/source3/include/smb.h b/source3/include/smb.h index f3cf1db6f8..3e0c997997 100644 --- a/source3/include/smb.h +++ b/source3/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 @@ -259,9 +259,6 @@ typedef struct dom_sid { uint32 sub_auths[MAXSUBAUTHS]; } DOM_SID; -#define dom_sid2 dom_sid -#define dom_sid28 dom_sid - enum id_mapping { ID_UNKNOWN = 0, ID_MAPPED, @@ -296,7 +293,7 @@ typedef struct data_blob { extern const DATA_BLOB data_blob_null; #include "librpc/gen_ndr/misc.h" -#include "librpc/ndr/security.h" +#include "librpc/gen_ndr/security.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/lsa.h" #include "librpc/gen_ndr/dfs.h" @@ -309,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/source3/lib/dprintf.c b/source3/lib/dprintf.c index 18b261623e..a3bb5be43a 100644 --- a/source3/lib/dprintf.c +++ b/source3/lib/dprintf.c @@ -47,7 +47,10 @@ lang_msg_free(msgstr); - if (ret <= 0) return ret; + if (ret <= 0) { + va_end(ap2); + return ret; + } /* now we have the string in unix format, convert it to the display charset, but beware of it growing */ @@ -56,6 +59,7 @@ again: p2 = (char *)SMB_MALLOC(maxlen); if (!p2) { SAFE_FREE(p); + va_end(ap2); return -1; } clen = convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen, True); @@ -72,6 +76,8 @@ again: ret = fwrite(p2, 1, clen, f); SAFE_FREE(p2); + va_end(ap2); + return ret; } diff --git a/source3/lib/fault.c b/source3/lib/fault.c index 33e1401d7a..1964955f1b 100644 --- a/source3/lib/fault.c +++ b/source3/lib/fault.c @@ -132,7 +132,6 @@ void dump_core_setup(const char *progname) sys_chown(corepath,getuid(),getgid()); chmod(corepath,0700); - SAFE_FREE(corepath); SAFE_FREE(logbase); #ifdef HAVE_GETRLIMIT diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 5c3f7ec465..47b3ba93cf 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -119,7 +119,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) gencache_shutdown(); secrets_shutdown(); - regdb_close(); TALLOC_FREE(ctx); TALLOC_FREE(frame); diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index c2f1b488db..002fc37762 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -36,6 +36,11 @@ /**************************************************************** ****************************************************************/ +#define LIBNETAPI_LOCAL_SERVER(x) (!x || is_myname_or_ipaddr(x)) + +/**************************************************************** +****************************************************************/ + struct libnetapi_ctx { char *debuglevel; char *error_string; diff --git a/source3/lib/util.c b/source3/lib/util.c index e5ac3752f5..dba7142bad 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2431,6 +2431,7 @@ char *smb_xstrndup(const char *s, size_t n) if (n == -1 || ! *ptr) { smb_panic("smb_xvasprintf: out of memory"); } + va_end(ap2); return n; } diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 1a7cc02229..ced1130536 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1123,20 +1123,16 @@ ssize_t read_smb_length_return_keepalive(int fd, { ssize_t len=0; int msg_type; - bool ok = false; - while (!ok) { - ok = (read_socket_with_timeout(fd,inbuf,4,4,timeout,pre) == 4); - if (!ok) { - return -1; - } + if (read_socket_with_timeout(fd, inbuf, 4, 4, timeout, pre) != 4) { + return -1; + } - len = smb_len(inbuf); - msg_type = CVAL(inbuf,0); + len = smb_len(inbuf); + msg_type = CVAL(inbuf,0); - if (msg_type == SMBkeepalive) { - DEBUG(5,("Got keepalive packet\n")); - } + if (msg_type == SMBkeepalive) { + DEBUG(5,("Got keepalive packet\n")); } DEBUG(10,("got smb length of %lu\n",(unsigned long)len)); @@ -1154,16 +1150,15 @@ ssize_t read_smb_length_return_keepalive(int fd, ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read_errors *pre) { ssize_t len; + uint8_t msgtype = SMBkeepalive; - for(;;) { - len = read_smb_length_return_keepalive(fd, inbuf, timeout, pre); - - if(len < 0) + while (msgtype == SMBkeepalive) { + len = read_smb_length_return_keepalive(fd, inbuf, timeout, + pre); + if (len < 0) { return len; - - /* Ignore session keepalives. */ - if(CVAL(inbuf,0) != SMBkeepalive) - break; + } + msgtype = CVAL(inbuf, 0); } DEBUG(10,("read_smb_length: got smb length of %lu\n", diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index ce2cb427d1..dd5ebcd7ab 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -656,6 +656,7 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...) return PTR_DIFF(buf, buf0); no_space: + va_end(ap); return -1; } diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index c98522200b..ee6e581332 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -223,9 +223,15 @@ size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) VA_COPY(ap2, ap); len = vasprintf(&p, format, ap2); - if (len <= 0) return len; + if (len <= 0) { + va_end(ap2); + return len; + } ret = x_fwrite(p, 1, len, f); SAFE_FREE(p); + + va_end(ap2); + return ret; } diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index b99525047f..d47e8a3ff1 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -865,10 +865,14 @@ bool create_local_private_krb5_conf_for_domain(const char *realm, return False; } - file_contents = talloc_asprintf(fname, "[libdefaults]\n\tdefault_realm = %s\n\n" - "[realms]\n\t%s = {\n" - "\t%s\t}\n", - realm_upper, realm_upper, kdc_ip_string); + file_contents = talloc_asprintf(fname, + "[libdefaults]\n\tdefault_realm = %s\n" + "default_tgs_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n" + "default_tkt_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n" + "preferred_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n\n" + "[realms]\n\t%s = {\n" + "\t%s\t}\n", + realm_upper, realm_upper, kdc_ip_string); if (!file_contents) { TALLOC_FREE(dname); diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 538cca7994..f83e0fbb60 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -684,10 +684,12 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, const_acct_name = acct_name; if (r->in.join_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE) { - uint32 acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | - SAMR_USER_GETATTR | SAMR_USER_SETATTR; + uint32_t acct_flags = + SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, diff --git a/source3/librpc/gen_ndr/cli_dssetup.c b/source3/librpc/gen_ndr/cli_dssetup.c new file mode 100644 index 0000000000..8947d99bb5 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_dssetup.c @@ -0,0 +1,476 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_dssetup.h" + +NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum dssetup_DsRoleInfoLevel level, + union dssetup_DsRoleInfo *info, + WERROR *werror) +{ + struct dssetup_DsRoleGetPrimaryDomainInformation r; + NTSTATUS status; + + /* In parameters */ + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + if (info && r.out.info) { + *info = *r.out.info; + } + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleDnsNameToFlatName r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDnsNameToFlatName, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDnsNameToFlatName, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleDcAsDc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleDcAsDc r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsDc, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEDCASDC, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsDc, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleDcAsReplica(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleDcAsReplica r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsReplica, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEDCASREPLICA, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsReplica, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleDemoteDc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleDemoteDc r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDemoteDc, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEDEMOTEDC, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDemoteDc, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleGetDcOperationProgress r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationProgress, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationProgress, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleGetDcOperationResults r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationResults, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationResults, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleCancel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleCancel r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleCancel, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLECANCEL, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleCancel, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleServerSaveStateForUpgrade r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleUpgradeDownlevelServer r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) +{ + struct dssetup_DsRoleAbortDownlevelServerUpgrade r; + NTSTATUS status; + + /* In parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_DSSETUP, + &ndr_table_dssetup, + NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + if (werror) { + *werror = r.out.result; + } + + return werror_to_ntstatus(r.out.result); +} + diff --git a/source3/librpc/gen_ndr/cli_dssetup.h b/source3/librpc/gen_ndr/cli_dssetup.h new file mode 100644 index 0000000000..b645c26829 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_dssetup.h @@ -0,0 +1,39 @@ +#include "librpc/gen_ndr/ndr_dssetup.h" +#ifndef __CLI_DSSETUP__ +#define __CLI_DSSETUP__ +NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum dssetup_DsRoleInfoLevel level, + union dssetup_DsRoleInfo *info, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleDcAsDc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleDcAsReplica(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleDemoteDc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleCancel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +#endif /* __CLI_DSSETUP__ */ diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index 414e053dc9..8bed385414 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -1183,24 +1183,29 @@ NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror) +NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + uint32_t *rid, + WERROR *werror) { - struct netr_NETRLOGONGETTRUSTRID r; + struct netr_LogonGetTrustRid r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.domain_name = domain_name; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, &r); } status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, - NDR_NETR_NETRLOGONGETTRUSTRID, + NDR_NETR_LOGONGETTRUSTRID, &r); if (!NT_STATUS_IS_OK(status)) { @@ -1208,7 +1213,7 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1216,6 +1221,7 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, } /* Return variables */ + *rid = *r.out.rid; /* Return result */ if (werror) { @@ -1369,7 +1375,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, struct GUID *domain_guid, const char *site_name, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror) { struct netr_DsRGetDCNameEx r; @@ -1722,7 +1728,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, struct GUID *domain_guid, const char *site_name, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror) { struct netr_DsRGetDCNameEx2 r; @@ -2013,7 +2019,7 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, - struct netr_DomainTrustList **trusts, + struct netr_DomainTrustList *trusts, WERROR *werror) { struct netr_DsrEnumerateDomainTrusts r; @@ -2057,17 +2063,27 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain, + struct GUID *domain_guid, + struct GUID *dsa_guid, + const char *dns_host, WERROR *werror) { - struct netr_DSRDEREGISTERDNSHOSTRECORDS r; + struct netr_DsrDeregisterDNSHostRecords r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.domain = domain; + r.in.domain_guid = domain_guid; + r.in.dsa_guid = dsa_guid; + r.in.dns_host = dns_host; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, &r); } status = cli_do_rpc_ndr(cli, @@ -2082,7 +2098,7 @@ NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, &r); } if (NT_STATUS_IS_ERR(status)) { diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index 30a9645767..d98b87a8ba 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -185,9 +185,12 @@ NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror); +NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + uint32_t *rid, + WERROR *werror); NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); @@ -210,7 +213,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, struct GUID *domain_guid, const char *site_name, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror); NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -264,7 +267,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, struct GUID *domain_guid, const char *site_name, uint32_t flags, - struct netr_DsRGetDCNameInfo *info, + struct netr_DsRGetDCNameInfo **info, WERROR *werror); NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -300,10 +303,15 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, - struct netr_DomainTrustList **trusts, + struct netr_DomainTrustList *trusts, WERROR *werror); -NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain, + struct GUID *domain_guid, + struct GUID *dsa_guid, + const char *dns_host, WERROR *werror); NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/cli_samr.c b/source3/librpc/gen_ndr/cli_samr.c index 99e7e45b02..73c123bbdd 100644 --- a/source3/librpc/gen_ndr/cli_samr.c +++ b/source3/librpc/gen_ndr/cli_samr.c @@ -621,7 +621,9 @@ NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli, /* Return variables */ *resume_handle = *r.out.resume_handle; - *sam = *r.out.sam; + if (sam && r.out.sam) { + *sam = *r.out.sam; + } *num_entries = *r.out.num_entries; /* Return result */ diff --git a/source3/librpc/gen_ndr/dfs.h b/source3/librpc/gen_ndr/dfs.h index 38e7f93950..dc11e70b59 100644 --- a/source3/librpc/gen_ndr/dfs.h +++ b/source3/librpc/gen_ndr/dfs.h @@ -37,8 +37,6 @@ struct dfs_Info1 { #define DFS_VOLUME_STATE_STANDALONE ( DFS_VOLUME_FLAVOR_STANDALONE ) #define DFS_VOLUME_STATE_AD_BLOB ( DFS_VOLUME_FLAVOR_AD_BLOB ) -; - struct dfs_Info2 { const char *path;/* [unique,charset(UTF16)] */ const char *comment;/* [unique,charset(UTF16)] */ @@ -51,8 +49,6 @@ struct dfs_Info2 { #define DFS_STORAGE_STATE_ONLINE ( 2 ) #define DFS_STORAGE_STATE_ACTIVE ( 4 ) -; - struct dfs_StorageInfo { uint32_t state; const char *server;/* [unique,charset(UTF16)] */ @@ -84,8 +80,6 @@ struct dfs_Info4 { #define DFS_PROPERTY_FLAG_TARGET_FAILBACK ( 0x08 ) #define DFS_PROPERTY_FLAG_CLUSTER_ENABLED ( 0x10 ) -; - struct dfs_Info5 { const char *path;/* [unique,charset(UTF16)] */ const char *comment;/* [unique,charset(UTF16)] */ diff --git a/source3/librpc/gen_ndr/dssetup.h b/source3/librpc/gen_ndr/dssetup.h new file mode 100644 index 0000000000..d284a63375 --- /dev/null +++ b/source3/librpc/gen_ndr/dssetup.h @@ -0,0 +1,211 @@ +/* header auto-generated by pidl */ + +#include <stdint.h> + +#include "librpc/gen_ndr/misc.h" +#ifndef _HEADER_dssetup +#define _HEADER_dssetup + +enum dssetup_DsRole +#ifndef USE_UINT_ENUMS + { + DS_ROLE_STANDALONE_WORKSTATION=0, + DS_ROLE_MEMBER_WORKSTATION=1, + DS_ROLE_STANDALONE_SERVER=2, + DS_ROLE_MEMBER_SERVER=3, + DS_ROLE_BACKUP_DC=4, + DS_ROLE_PRIMARY_DC=5 +} +#else + { __donnot_use_enum_dssetup_DsRole=0x7FFFFFFF} +#define DS_ROLE_STANDALONE_WORKSTATION ( 0 ) +#define DS_ROLE_MEMBER_WORKSTATION ( 1 ) +#define DS_ROLE_STANDALONE_SERVER ( 2 ) +#define DS_ROLE_MEMBER_SERVER ( 3 ) +#define DS_ROLE_BACKUP_DC ( 4 ) +#define DS_ROLE_PRIMARY_DC ( 5 ) +#endif +; + +/* bitmap dssetup_DsRoleFlags */ +#define DS_ROLE_PRIMARY_DS_RUNNING ( 0x00000001 ) +#define DS_ROLE_PRIMARY_DS_MIXED_MODE ( 0x00000002 ) +#define DS_ROLE_UPGRADE_IN_PROGRESS ( 0x00000004 ) +#define DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT ( 0x01000000 ) + +struct dssetup_DsRolePrimaryDomInfoBasic { + enum dssetup_DsRole role; + uint32_t flags; + const char *domain;/* [unique,charset(UTF16)] */ + const char *dns_domain;/* [unique,charset(UTF16)] */ + const char *forest;/* [unique,charset(UTF16)] */ + struct GUID domain_guid; +}; + +enum dssetup_DsUpgrade +#ifndef USE_UINT_ENUMS + { + DS_ROLE_NOT_UPGRADING=0, + DS_ROLE_UPGRADING=1 +} +#else + { __donnot_use_enum_dssetup_DsUpgrade=0x7FFFFFFF} +#define DS_ROLE_NOT_UPGRADING ( 0 ) +#define DS_ROLE_UPGRADING ( 1 ) +#endif +; + +enum dssetup_DsPrevious +#ifndef USE_UINT_ENUMS + { + DS_ROLE_PREVIOUS_UNKNOWN=0, + DS_ROLE_PREVIOUS_PRIMARY=1, + DS_ROLE_PREVIOUS_BACKUP=2 +} +#else + { __donnot_use_enum_dssetup_DsPrevious=0x7FFFFFFF} +#define DS_ROLE_PREVIOUS_UNKNOWN ( 0 ) +#define DS_ROLE_PREVIOUS_PRIMARY ( 1 ) +#define DS_ROLE_PREVIOUS_BACKUP ( 2 ) +#endif +; + +struct dssetup_DsRoleUpgradeStatus { + enum dssetup_DsUpgrade upgrading; + enum dssetup_DsPrevious previous_role; +}; + +enum dssetup_DsRoleOp +#ifndef USE_UINT_ENUMS + { + DS_ROLE_OP_IDLE=0, + DS_ROLE_OP_ACTIVE=1, + DS_ROLE_OP_NEEDS_REBOOT=2 +} +#else + { __donnot_use_enum_dssetup_DsRoleOp=0x7FFFFFFF} +#define DS_ROLE_OP_IDLE ( 0 ) +#define DS_ROLE_OP_ACTIVE ( 1 ) +#define DS_ROLE_OP_NEEDS_REBOOT ( 2 ) +#endif +; + +struct dssetup_DsRoleOpStatus { + enum dssetup_DsRoleOp status; +}; + +enum dssetup_DsRoleInfoLevel +#ifndef USE_UINT_ENUMS + { + DS_ROLE_BASIC_INFORMATION=1, + DS_ROLE_UPGRADE_STATUS=2, + DS_ROLE_OP_STATUS=3 +} +#else + { __donnot_use_enum_dssetup_DsRoleInfoLevel=0x7FFFFFFF} +#define DS_ROLE_BASIC_INFORMATION ( 1 ) +#define DS_ROLE_UPGRADE_STATUS ( 2 ) +#define DS_ROLE_OP_STATUS ( 3 ) +#endif +; + +union dssetup_DsRoleInfo { + struct dssetup_DsRolePrimaryDomInfoBasic basic;/* [case(DS_ROLE_BASIC_INFORMATION)] */ + struct dssetup_DsRoleUpgradeStatus upgrade;/* [case(DS_ROLE_UPGRADE_STATUS)] */ + struct dssetup_DsRoleOpStatus opstatus;/* [case(DS_ROLE_OP_STATUS)] */ +}/* [switch_type(dssetup_DsRoleInfoLevel)] */; + + +struct dssetup_DsRoleGetPrimaryDomainInformation { + struct { + enum dssetup_DsRoleInfoLevel level; + } in; + + struct { + union dssetup_DsRoleInfo *info;/* [unique,switch_is(level)] */ + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleDnsNameToFlatName { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleDcAsDc { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleDcAsReplica { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleDemoteDc { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleGetDcOperationProgress { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleGetDcOperationResults { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleCancel { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleServerSaveStateForUpgrade { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleUpgradeDownlevelServer { + struct { + WERROR result; + } out; + +}; + + +struct dssetup_DsRoleAbortDownlevelServerUpgrade { + struct { + WERROR result; + } out; + +}; + +#endif /* _HEADER_dssetup */ diff --git a/source3/librpc/gen_ndr/eventlog.h b/source3/librpc/gen_ndr/eventlog.h index e13fb50a5d..656dadcc6c 100644 --- a/source3/librpc/gen_ndr/eventlog.h +++ b/source3/librpc/gen_ndr/eventlog.h @@ -13,8 +13,6 @@ #define EVENTLOG_FORWARDS_READ ( 0x0004 ) #define EVENTLOG_BACKWARDS_READ ( 0x0008 ) -; - /* bitmap eventlogEventTypes */ #define EVENTLOG_SUCCESS ( 0x0000 ) #define EVENTLOG_ERROR_TYPE ( 0x0001 ) @@ -23,8 +21,6 @@ #define EVENTLOG_AUDIT_SUCCESS ( 0x0008 ) #define EVENTLOG_AUDIT_FAILURE ( 0x0010 ) -; - struct eventlog_OpenUnknown0 { uint16_t unknown0; uint16_t unknown1; diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index cbaa9083e4..2657557d90 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -9,8 +9,6 @@ #define LSA_ENUM_TRUST_DOMAIN_MULTIPLIER ( 60 ) #define LSA_REF_DOMAIN_LIST_MULTIPLIER ( 32 ) #define LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER ( 82 ) -; - struct lsa_String { uint16_t length;/* [value(2*strlen_m(string))] */ uint16_t size;/* [value(2*strlen_m(string))] */ diff --git a/source3/librpc/gen_ndr/ndr_dssetup.c b/source3/librpc/gen_ndr/ndr_dssetup.c new file mode 100644 index 0000000000..f089b71cd4 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_dssetup.c @@ -0,0 +1,1084 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_dssetup.h" + +#include "librpc/gen_ndr/ndr_misc.h" +static enum ndr_err_code ndr_push_dssetup_DsRole(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRole r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRole(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRole *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r) +{ + const char *val = NULL; + + switch (r) { + case DS_ROLE_STANDALONE_WORKSTATION: val = "DS_ROLE_STANDALONE_WORKSTATION"; break; + case DS_ROLE_MEMBER_WORKSTATION: val = "DS_ROLE_MEMBER_WORKSTATION"; break; + case DS_ROLE_STANDALONE_SERVER: val = "DS_ROLE_STANDALONE_SERVER"; break; + case DS_ROLE_MEMBER_SERVER: val = "DS_ROLE_MEMBER_SERVER"; break; + case DS_ROLE_BACKUP_DC: val = "DS_ROLE_BACKUP_DC"; break; + case DS_ROLE_PRIMARY_DC: val = "DS_ROLE_PRIMARY_DC"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DS_RUNNING", DS_ROLE_PRIMARY_DS_RUNNING, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DS_MIXED_MODE", DS_ROLE_PRIMARY_DS_MIXED_MODE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_UPGRADE_IN_PROGRESS", DS_ROLE_UPGRADE_IN_PROGRESS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT", DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRolePrimaryDomInfoBasic *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_dssetup_DsRole(ndr, NDR_SCALARS, r->role)); + NDR_CHECK(ndr_push_dssetup_DsRoleFlags(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->dns_domain)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_guid)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->domain) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->domain, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->domain, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->domain, ndr_charset_length(r->domain, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + if (r->dns_domain) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dns_domain, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dns_domain, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->dns_domain, ndr_charset_length(r->dns_domain, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + if (r->forest) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->forest, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->forest, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->forest, ndr_charset_length(r->forest, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_guid)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRolePrimaryDomInfoBasic *r) +{ + uint32_t _ptr_domain; + TALLOC_CTX *_mem_save_domain_0; + uint32_t _ptr_dns_domain; + TALLOC_CTX *_mem_save_dns_domain_0; + uint32_t _ptr_forest; + TALLOC_CTX *_mem_save_forest_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_dssetup_DsRole(ndr, NDR_SCALARS, &r->role)); + NDR_CHECK(ndr_pull_dssetup_DsRoleFlags(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain)); + if (_ptr_domain) { + NDR_PULL_ALLOC(ndr, r->domain); + } else { + r->domain = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dns_domain)); + if (_ptr_dns_domain) { + NDR_PULL_ALLOC(ndr, r->dns_domain); + } else { + r->dns_domain = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest)); + if (_ptr_forest) { + NDR_PULL_ALLOC(ndr, r->forest); + } else { + r->forest = NULL; + } + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_guid)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->domain) { + _mem_save_domain_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->domain, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->domain)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->domain)); + if (ndr_get_array_length(ndr, &r->domain) > ndr_get_array_size(ndr, &r->domain)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->domain), ndr_get_array_length(ndr, &r->domain)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->domain), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->domain, ndr_get_array_length(ndr, &r->domain), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_0, 0); + } + if (r->dns_domain) { + _mem_save_dns_domain_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->dns_domain, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->dns_domain)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->dns_domain)); + if (ndr_get_array_length(ndr, &r->dns_domain) > ndr_get_array_size(ndr, &r->dns_domain)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->dns_domain), ndr_get_array_length(ndr, &r->dns_domain)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->dns_domain), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->dns_domain, ndr_get_array_length(ndr, &r->dns_domain), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dns_domain_0, 0); + } + if (r->forest) { + _mem_save_forest_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->forest, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->forest)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->forest)); + if (ndr_get_array_length(ndr, &r->forest) > ndr_get_array_size(ndr, &r->forest)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->forest), ndr_get_array_length(ndr, &r->forest)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->forest), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->forest, ndr_get_array_length(ndr, &r->forest), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_0, 0); + } + NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_guid)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRolePrimaryDomInfoBasic"); + ndr->depth++; + ndr_print_dssetup_DsRole(ndr, "role", r->role); + ndr_print_dssetup_DsRoleFlags(ndr, "flags", r->flags); + ndr_print_ptr(ndr, "domain", r->domain); + ndr->depth++; + if (r->domain) { + ndr_print_string(ndr, "domain", r->domain); + } + ndr->depth--; + ndr_print_ptr(ndr, "dns_domain", r->dns_domain); + ndr->depth++; + if (r->dns_domain) { + ndr_print_string(ndr, "dns_domain", r->dns_domain); + } + ndr->depth--; + ndr_print_ptr(ndr, "forest", r->forest); + ndr->depth++; + if (r->forest) { + ndr_print_string(ndr, "forest", r->forest); + } + ndr->depth--; + ndr_print_GUID(ndr, "domain_guid", &r->domain_guid); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsUpgrade(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsUpgrade r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsUpgrade(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsUpgrade *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r) +{ + const char *val = NULL; + + switch (r) { + case DS_ROLE_NOT_UPGRADING: val = "DS_ROLE_NOT_UPGRADING"; break; + case DS_ROLE_UPGRADING: val = "DS_ROLE_UPGRADING"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dssetup_DsPrevious(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsPrevious r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsPrevious(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsPrevious *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r) +{ + const char *val = NULL; + + switch (r) { + case DS_ROLE_PREVIOUS_UNKNOWN: val = "DS_ROLE_PREVIOUS_UNKNOWN"; break; + case DS_ROLE_PREVIOUS_PRIMARY: val = "DS_ROLE_PREVIOUS_PRIMARY"; break; + case DS_ROLE_PREVIOUS_BACKUP: val = "DS_ROLE_PREVIOUS_BACKUP"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleUpgradeStatus(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRoleUpgradeStatus *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_dssetup_DsUpgrade(ndr, NDR_SCALARS, r->upgrading)); + NDR_CHECK(ndr_push_dssetup_DsPrevious(ndr, NDR_SCALARS, r->previous_role)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleUpgradeStatus(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRoleUpgradeStatus *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_dssetup_DsUpgrade(ndr, NDR_SCALARS, &r->upgrading)); + NDR_CHECK(ndr_pull_dssetup_DsPrevious(ndr, NDR_SCALARS, &r->previous_role)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleUpgradeStatus"); + ndr->depth++; + ndr_print_dssetup_DsUpgrade(ndr, "upgrading", r->upgrading); + ndr_print_dssetup_DsPrevious(ndr, "previous_role", r->previous_role); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleOp(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRoleOp r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleOp(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRoleOp *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r) +{ + const char *val = NULL; + + switch (r) { + case DS_ROLE_OP_IDLE: val = "DS_ROLE_OP_IDLE"; break; + case DS_ROLE_OP_ACTIVE: val = "DS_ROLE_OP_ACTIVE"; break; + case DS_ROLE_OP_NEEDS_REBOOT: val = "DS_ROLE_OP_NEEDS_REBOOT"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleOpStatus(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRoleOpStatus *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 2)); + NDR_CHECK(ndr_push_dssetup_DsRoleOp(ndr, NDR_SCALARS, r->status)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleOpStatus(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRoleOpStatus *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 2)); + NDR_CHECK(ndr_pull_dssetup_DsRoleOp(ndr, NDR_SCALARS, &r->status)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleOpStatus"); + ndr->depth++; + ndr_print_dssetup_DsRoleOp(ndr, "status", r->status); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleInfoLevel(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRoleInfoLevel r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleInfoLevel(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRoleInfoLevel *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r) +{ + const char *val = NULL; + + switch (r) { + case DS_ROLE_BASIC_INFORMATION: val = "DS_ROLE_BASIC_INFORMATION"; break; + case DS_ROLE_UPGRADE_STATUS: val = "DS_ROLE_UPGRADE_STATUS"; break; + case DS_ROLE_OP_STATUS: val = "DS_ROLE_OP_STATUS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleInfo(struct ndr_push *ndr, int ndr_flags, const union dssetup_DsRoleInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, level)); + switch (level) { + case DS_ROLE_BASIC_INFORMATION: + NDR_CHECK(ndr_push_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_SCALARS, &r->basic)); + break; + + case DS_ROLE_UPGRADE_STATUS: + NDR_CHECK(ndr_push_dssetup_DsRoleUpgradeStatus(ndr, NDR_SCALARS, &r->upgrade)); + break; + + case DS_ROLE_OP_STATUS: + NDR_CHECK(ndr_push_dssetup_DsRoleOpStatus(ndr, NDR_SCALARS, &r->opstatus)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case DS_ROLE_BASIC_INFORMATION: + NDR_CHECK(ndr_push_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_BUFFERS, &r->basic)); + break; + + case DS_ROLE_UPGRADE_STATUS: + break; + + case DS_ROLE_OP_STATUS: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleInfo(struct ndr_pull *ndr, int ndr_flags, union dssetup_DsRoleInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case DS_ROLE_BASIC_INFORMATION: { + NDR_CHECK(ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_SCALARS, &r->basic)); + break; } + + case DS_ROLE_UPGRADE_STATUS: { + NDR_CHECK(ndr_pull_dssetup_DsRoleUpgradeStatus(ndr, NDR_SCALARS, &r->upgrade)); + break; } + + case DS_ROLE_OP_STATUS: { + NDR_CHECK(ndr_pull_dssetup_DsRoleOpStatus(ndr, NDR_SCALARS, &r->opstatus)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case DS_ROLE_BASIC_INFORMATION: + NDR_CHECK(ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_BUFFERS, &r->basic)); + break; + + case DS_ROLE_UPGRADE_STATUS: + break; + + case DS_ROLE_OP_STATUS: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "dssetup_DsRoleInfo"); + switch (level) { + case DS_ROLE_BASIC_INFORMATION: + ndr_print_dssetup_DsRolePrimaryDomInfoBasic(ndr, "basic", &r->basic); + break; + + case DS_ROLE_UPGRADE_STATUS: + ndr_print_dssetup_DsRoleUpgradeStatus(ndr, "upgrade", &r->upgrade); + break; + + case DS_ROLE_OP_STATUS: + ndr_print_dssetup_DsRoleOpStatus(ndr, "opstatus", &r->opstatus); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); + if (r->out.info) { + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_dssetup_DsRoleInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetPrimaryDomainInformation *r) +{ + uint32_t _ptr_info; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, &r->in.level)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_PULL_ALLOC(ndr, r->out.info); + } else { + r->out.info = NULL; + } + if (r->out.info) { + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_dssetup_DsRoleInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleGetPrimaryDomainInformation"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleGetPrimaryDomainInformation"); + ndr->depth++; + ndr_print_dssetup_DsRoleInfoLevel(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleGetPrimaryDomainInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + if (r->out.info) { + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_dssetup_DsRoleInfo(ndr, "info", r->out.info); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleDnsNameToFlatName(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleDnsNameToFlatName(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDnsNameToFlatName *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleDnsNameToFlatName"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleDnsNameToFlatName"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleDnsNameToFlatName"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleDcAsDc(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDcAsDc *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleDcAsDc(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDcAsDc *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleDcAsDc"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleDcAsDc"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleDcAsDc"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleDcAsReplica(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDcAsReplica *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleDcAsReplica(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDcAsReplica *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleDcAsReplica"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleDcAsReplica"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleDcAsReplica"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleDemoteDc(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDemoteDc *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleDemoteDc(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDemoteDc *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleDemoteDc"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleDemoteDc"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleDemoteDc"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleGetDcOperationProgress(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleGetDcOperationProgress(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetDcOperationProgress *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleGetDcOperationProgress"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleGetDcOperationProgress"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleGetDcOperationProgress"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleGetDcOperationResults(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetDcOperationResults *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleGetDcOperationResults(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetDcOperationResults *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleGetDcOperationResults"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleGetDcOperationResults"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleGetDcOperationResults"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleCancel(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleCancel *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleCancel(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleCancel *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleCancel"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleCancel"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleCancel"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleServerSaveStateForUpgrade *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleServerSaveStateForUpgrade"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleServerSaveStateForUpgrade"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleServerSaveStateForUpgrade"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleUpgradeDownlevelServer *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleUpgradeDownlevelServer"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleUpgradeDownlevelServer"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleUpgradeDownlevelServer"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r) +{ + ndr_print_struct(ndr, name, "dssetup_DsRoleAbortDownlevelServerUpgrade"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "dssetup_DsRoleAbortDownlevelServerUpgrade"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "dssetup_DsRoleAbortDownlevelServerUpgrade"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static const struct ndr_interface_call dssetup_calls[] = { + { + "dssetup_DsRoleGetPrimaryDomainInformation", + sizeof(struct dssetup_DsRoleGetPrimaryDomainInformation), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetPrimaryDomainInformation, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetPrimaryDomainInformation, + (ndr_print_function_t) ndr_print_dssetup_DsRoleGetPrimaryDomainInformation, + false, + }, + { + "dssetup_DsRoleDnsNameToFlatName", + sizeof(struct dssetup_DsRoleDnsNameToFlatName), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDnsNameToFlatName, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDnsNameToFlatName, + (ndr_print_function_t) ndr_print_dssetup_DsRoleDnsNameToFlatName, + false, + }, + { + "dssetup_DsRoleDcAsDc", + sizeof(struct dssetup_DsRoleDcAsDc), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsDc, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsDc, + (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsDc, + false, + }, + { + "dssetup_DsRoleDcAsReplica", + sizeof(struct dssetup_DsRoleDcAsReplica), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsReplica, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsReplica, + (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsReplica, + false, + }, + { + "dssetup_DsRoleDemoteDc", + sizeof(struct dssetup_DsRoleDemoteDc), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDemoteDc, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDemoteDc, + (ndr_print_function_t) ndr_print_dssetup_DsRoleDemoteDc, + false, + }, + { + "dssetup_DsRoleGetDcOperationProgress", + sizeof(struct dssetup_DsRoleGetDcOperationProgress), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationProgress, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationProgress, + (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationProgress, + false, + }, + { + "dssetup_DsRoleGetDcOperationResults", + sizeof(struct dssetup_DsRoleGetDcOperationResults), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationResults, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationResults, + (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationResults, + false, + }, + { + "dssetup_DsRoleCancel", + sizeof(struct dssetup_DsRoleCancel), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleCancel, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleCancel, + (ndr_print_function_t) ndr_print_dssetup_DsRoleCancel, + false, + }, + { + "dssetup_DsRoleServerSaveStateForUpgrade", + sizeof(struct dssetup_DsRoleServerSaveStateForUpgrade), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleServerSaveStateForUpgrade, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleServerSaveStateForUpgrade, + (ndr_print_function_t) ndr_print_dssetup_DsRoleServerSaveStateForUpgrade, + false, + }, + { + "dssetup_DsRoleUpgradeDownlevelServer", + sizeof(struct dssetup_DsRoleUpgradeDownlevelServer), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleUpgradeDownlevelServer, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleUpgradeDownlevelServer, + (ndr_print_function_t) ndr_print_dssetup_DsRoleUpgradeDownlevelServer, + false, + }, + { + "dssetup_DsRoleAbortDownlevelServerUpgrade", + sizeof(struct dssetup_DsRoleAbortDownlevelServerUpgrade), + (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleAbortDownlevelServerUpgrade, + (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleAbortDownlevelServerUpgrade, + (ndr_print_function_t) ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade, + false, + }, + { NULL, 0, NULL, NULL, NULL, false } +}; + +static const char * const dssetup_endpoint_strings[] = { + "ncacn_np:[\\pipe\\lsarpc]", + "ncacn_np:[\\pipe\\lsass]", + "ncacn_ip_tcp:", + "ncalrpc:", +}; + +static const struct ndr_interface_string_array dssetup_endpoints = { + .count = 4, + .names = dssetup_endpoint_strings +}; + +static const char * const dssetup_authservice_strings[] = { + "host", +}; + +static const struct ndr_interface_string_array dssetup_authservices = { + .count = 4, + .names = dssetup_authservice_strings +}; + + +const struct ndr_interface_table ndr_table_dssetup = { + .name = "dssetup", + .syntax_id = { + {0x3919286a,0xb10c,0x11d0,{0x9b,0xa8},{0x00,0xc0,0x4f,0xd9,0x2e,0xf5}}, + NDR_DSSETUP_VERSION + }, + .helpstring = NDR_DSSETUP_HELPSTRING, + .num_calls = 11, + .calls = dssetup_calls, + .endpoints = &dssetup_endpoints, + .authservices = &dssetup_authservices +}; + diff --git a/source3/librpc/gen_ndr/ndr_dssetup.h b/source3/librpc/gen_ndr/ndr_dssetup.h new file mode 100644 index 0000000000..103ad116a3 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_dssetup.h @@ -0,0 +1,58 @@ +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/dssetup.h" + +#ifndef _HEADER_NDR_dssetup +#define _HEADER_NDR_dssetup + +#define NDR_DSSETUP_UUID "3919286a-b10c-11d0-9ba8-00c04fd92ef5" +#define NDR_DSSETUP_VERSION 0.0 +#define NDR_DSSETUP_NAME "dssetup" +#define NDR_DSSETUP_HELPSTRING "Active Directory Setup" +extern const struct ndr_interface_table ndr_table_dssetup; +#define NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION (0x00) + +#define NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME (0x01) + +#define NDR_DSSETUP_DSROLEDCASDC (0x02) + +#define NDR_DSSETUP_DSROLEDCASREPLICA (0x03) + +#define NDR_DSSETUP_DSROLEDEMOTEDC (0x04) + +#define NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS (0x05) + +#define NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS (0x06) + +#define NDR_DSSETUP_DSROLECANCEL (0x07) + +#define NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE (0x08) + +#define NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER (0x09) + +#define NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE (0x0a) + +#define NDR_DSSETUP_CALL_COUNT (11) +void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r); +void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r); +void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r); +void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r); +void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r); +void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r); +void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r); +void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r); +void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r); +void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r); +void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r); +void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r); +void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r); +void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r); +void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r); +void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r); +void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r); +void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r); +void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r); +void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); +#endif /* _HEADER_NDR_dssetup */ diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 8a5ac4726f..619f08a781 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -327,12 +327,39 @@ _PUBLIC_ void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name ndr->depth--; } +_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_CLEARTEXT_PASSWORD_ALLOWED", MSV1_0_CLEARTEXT_PASSWORD_ALLOWED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_UPDATE_LOGON_STATISTICS", MSV1_0_UPDATE_LOGON_STATISTICS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_RETURN_USER_PARAMETERS", MSV1_0_RETURN_USER_PARAMETERS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT", MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_RETURN_PROFILE_PATH", MSV1_0_RETURN_PROFILE_PATH, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT", MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT, r); + ndr->depth--; +} + static enum ndr_err_code ndr_push_netr_IdentityInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_IdentityInfo *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->parameter_control)); + NDR_CHECK(ndr_push_netr_LogonParameterControl(ndr, NDR_SCALARS, r->parameter_control)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->logon_id_low)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->logon_id_high)); NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); @@ -351,7 +378,7 @@ static enum ndr_err_code ndr_pull_netr_IdentityInfo(struct ndr_pull *ndr, int nd if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->parameter_control)); + NDR_CHECK(ndr_pull_netr_LogonParameterControl(ndr, NDR_SCALARS, &r->parameter_control)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->logon_id_low)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->logon_id_high)); NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); @@ -370,7 +397,7 @@ _PUBLIC_ void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *nam ndr_print_struct(ndr, name, "netr_IdentityInfo"); ndr->depth++; ndr_print_lsa_String(ndr, "domain_name", &r->domain_name); - ndr_print_uint32(ndr, "parameter_control", r->parameter_control); + ndr_print_netr_LogonParameterControl(ndr, "parameter_control", r->parameter_control); ndr_print_uint32(ndr, "logon_id_low", r->logon_id_low); ndr_print_uint32(ndr, "logon_id_high", r->logon_id_high); ndr_print_lsa_String(ndr, "account_name", &r->account_name); @@ -814,39 +841,6 @@ _PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, } } -_PUBLIC_ enum ndr_err_code ndr_push_netr_GroupMembership(struct ndr_push *ndr, int ndr_flags, const struct netr_GroupMembership *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attributes)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ enum ndr_err_code ndr_pull_netr_GroupMembership(struct ndr_pull *ndr, int ndr_flags, struct netr_GroupMembership *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attributes)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_netr_GroupMembership(struct ndr_print *ndr, const char *name, const struct netr_GroupMembership *r) -{ - ndr_print_struct(ndr, name, "netr_GroupMembership"); - ndr->depth++; - ndr_print_uint32(ndr, "rid", r->rid); - ndr_print_uint32(ndr, "attributes", r->attributes); - ndr->depth--; -} - _PUBLIC_ enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r) { { @@ -1164,7 +1158,7 @@ static enum ndr_err_code ndr_push_netr_SidAttr(struct ndr_push *ndr, int ndr_fla if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attribute)); + NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes)); } if (ndr_flags & NDR_BUFFERS) { if (r->sid) { @@ -1186,7 +1180,7 @@ static enum ndr_err_code ndr_pull_netr_SidAttr(struct ndr_pull *ndr, int ndr_fla } else { r->sid = NULL; } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attribute)); + NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes)); } if (ndr_flags & NDR_BUFFERS) { if (r->sid) { @@ -1209,7 +1203,7 @@ _PUBLIC_ void ndr_print_netr_SidAttr(struct ndr_print *ndr, const char *name, co ndr_print_dom_sid2(ndr, "sid", r->sid); } ndr->depth--; - ndr_print_uint32(ndr, "attribute", r->attribute); + ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes); ndr->depth--; } @@ -11190,41 +11184,127 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, cons ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRLOGONGETTRUSTRID(struct ndr_push *ndr, int flags, const struct netr_NETRLOGONGETTRUSTRID *r) +static enum ndr_err_code ndr_push_netr_LogonGetTrustRid(struct ndr_push *ndr, int flags, const struct netr_LogonGetTrustRid *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name)); + if (r->in.domain_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.domain_name, ndr_charset_length(r->in.domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } if (flags & NDR_OUT) { + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRLOGONGETTRUSTRID(struct ndr_pull *ndr, int flags, struct netr_NETRLOGONGETTRUSTRID *r) +static enum ndr_err_code ndr_pull_netr_LogonGetTrustRid(struct ndr_pull *ndr, int flags, struct netr_LogonGetTrustRid *r) { + uint32_t _ptr_server_name; + uint32_t _ptr_domain_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_domain_name_0; + TALLOC_CTX *_mem_save_rid_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name)); + if (_ptr_domain_name) { + NDR_PULL_ALLOC(ndr, r->in.domain_name); + } else { + r->in.domain_name = NULL; + } + if (r->in.domain_name) { + _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.domain_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.domain_name)); + if (ndr_get_array_length(ndr, &r->in.domain_name) > ndr_get_array_size(ndr, &r->in.domain_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.domain_name), ndr_get_array_length(ndr, &r->in.domain_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.domain_name, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r) +_PUBLIC_ void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r) { - ndr_print_struct(ndr, name, "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, name, "netr_LogonGetTrustRid"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, "in", "netr_LogonGetTrustRid"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_ptr(ndr, "domain_name", r->in.domain_name); ndr->depth++; + if (r->in.domain_name) { + ndr_print_string(ndr, "domain_name", r->in.domain_name); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRLOGONGETTRUSTRID"); + ndr_print_struct(ndr, "out", "netr_LogonGetTrustRid"); + ndr->depth++; + ndr_print_ptr(ndr, "rid", r->out.rid); ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -11534,7 +11614,11 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx(struct ndr_push *ndr, int if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (*r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -11546,11 +11630,13 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_name; + uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_domain_name_0; TALLOC_CTX *_mem_save_domain_guid_0; TALLOC_CTX *_mem_save_site_name_0; TALLOC_CTX *_mem_save_info_0; + TALLOC_CTX *_mem_save_info_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -11630,7 +11716,14 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.info); + } + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -11679,7 +11772,10 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); + ndr_print_ptr(ndr, "info", *r->out.info); + ndr->depth++; + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -12491,7 +12587,11 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (*r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -12504,12 +12604,14 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_name; + uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_client_account_0; TALLOC_CTX *_mem_save_domain_name_0; TALLOC_CTX *_mem_save_domain_guid_0; TALLOC_CTX *_mem_save_site_name_0; TALLOC_CTX *_mem_save_info_0; + TALLOC_CTX *_mem_save_info_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -12608,7 +12710,14 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.info); + } + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -12664,7 +12773,10 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); + ndr_print_ptr(ndr, "info", *r->out.info); + ndr->depth++; + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -13270,11 +13382,7 @@ static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push if (r->out.trusts == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.trusts == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.trusts)); + NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -13283,10 +13391,8 @@ static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull *ndr, int flags, struct netr_DsrEnumerateDomainTrusts *r) { uint32_t _ptr_server_name; - uint32_t _ptr_trusts; TALLOC_CTX *_mem_save_server_name_0; TALLOC_CTX *_mem_save_trusts_0; - TALLOC_CTX *_mem_save_trusts_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -13318,14 +13424,7 @@ static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull } _mem_save_trusts_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_trusts)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, *r->out.trusts); - } - _mem_save_trusts_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.trusts, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.trusts)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_1, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -13356,10 +13455,7 @@ _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "trusts", r->out.trusts); ndr->depth++; - ndr_print_ptr(ndr, "trusts", *r->out.trusts); - ndr->depth++; - ndr_print_netr_DomainTrustList(ndr, "trusts", *r->out.trusts); - ndr->depth--; + ndr_print_netr_DomainTrustList(ndr, "trusts", r->out.trusts); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -13367,9 +13463,38 @@ _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, con ndr->depth--; } -static enum ndr_err_code ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_push *ndr, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r) +static enum ndr_err_code ndr_push_netr_DsrDeregisterDNSHostRecords(struct ndr_push *ndr, int flags, const struct netr_DsrDeregisterDNSHostRecords *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain)); + if (r->in.domain) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.domain, ndr_charset_length(r->in.domain, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_guid)); + if (r->in.domain_guid) { + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_guid)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.dsa_guid)); + if (r->in.dsa_guid) { + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.dsa_guid)); + } + if (r->in.dns_host == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dns_host, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dns_host, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.dns_host, ndr_charset_length(r->in.dns_host, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); @@ -13377,9 +13502,84 @@ static enum ndr_err_code ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pu return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pull *ndr, int flags, struct netr_DSRDEREGISTERDNSHOSTRECORDS *r) +static enum ndr_err_code ndr_pull_netr_DsrDeregisterDNSHostRecords(struct ndr_pull *ndr, int flags, struct netr_DsrDeregisterDNSHostRecords *r) { + uint32_t _ptr_server_name; + uint32_t _ptr_domain; + uint32_t _ptr_domain_guid; + uint32_t _ptr_dsa_guid; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_domain_0; + TALLOC_CTX *_mem_save_domain_guid_0; + TALLOC_CTX *_mem_save_dsa_guid_0; if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain)); + if (_ptr_domain) { + NDR_PULL_ALLOC(ndr, r->in.domain); + } else { + r->in.domain = NULL; + } + if (r->in.domain) { + _mem_save_domain_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.domain)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.domain)); + if (ndr_get_array_length(ndr, &r->in.domain) > ndr_get_array_size(ndr, &r->in.domain)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.domain), ndr_get_array_length(ndr, &r->in.domain)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.domain), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.domain, ndr_get_array_length(ndr, &r->in.domain), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_guid)); + if (_ptr_domain_guid) { + NDR_PULL_ALLOC(ndr, r->in.domain_guid); + } else { + r->in.domain_guid = NULL; + } + if (r->in.domain_guid) { + _mem_save_domain_guid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_guid, 0); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_guid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_guid_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dsa_guid)); + if (_ptr_dsa_guid) { + NDR_PULL_ALLOC(ndr, r->in.dsa_guid); + } else { + r->in.dsa_guid = NULL; + } + if (r->in.dsa_guid) { + _mem_save_dsa_guid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.dsa_guid, 0); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.dsa_guid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dsa_guid_0, 0); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.dns_host)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.dns_host)); + if (ndr_get_array_length(ndr, &r->in.dns_host) > ndr_get_array_size(ndr, &r->in.dns_host)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.dns_host), ndr_get_array_length(ndr, &r->in.dns_host)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.dns_host), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.dns_host, ndr_get_array_length(ndr, &r->in.dns_host), sizeof(uint16_t), CH_UTF16)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); @@ -13387,20 +13587,48 @@ static enum ndr_err_code ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pu return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r) +_PUBLIC_ void ndr_print_netr_DsrDeregisterDNSHostRecords(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrDeregisterDNSHostRecords *r) { - ndr_print_struct(ndr, name, "netr_DSRDEREGISTERDNSHOSTRECORDS"); + ndr_print_struct(ndr, name, "netr_DsrDeregisterDNSHostRecords"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_DSRDEREGISTERDNSHOSTRECORDS"); + ndr_print_struct(ndr, "in", "netr_DsrDeregisterDNSHostRecords"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_ptr(ndr, "domain", r->in.domain); + ndr->depth++; + if (r->in.domain) { + ndr_print_string(ndr, "domain", r->in.domain); + } + ndr->depth--; + ndr_print_ptr(ndr, "domain_guid", r->in.domain_guid); ndr->depth++; + if (r->in.domain_guid) { + ndr_print_GUID(ndr, "domain_guid", r->in.domain_guid); + } + ndr->depth--; + ndr_print_ptr(ndr, "dsa_guid", r->in.dsa_guid); + ndr->depth++; + if (r->in.dsa_guid) { + ndr_print_GUID(ndr, "dsa_guid", r->in.dsa_guid); + } + ndr->depth--; + ndr_print_ptr(ndr, "dns_host", r->in.dns_host); + ndr->depth++; + ndr_print_string(ndr, "dns_host", r->in.dns_host); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_DSRDEREGISTERDNSHOSTRECORDS"); + ndr_print_struct(ndr, "out", "netr_DsrDeregisterDNSHostRecords"); ndr->depth++; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -14382,11 +14610,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRLOGONGETTRUSTRID", - sizeof(struct netr_NETRLOGONGETTRUSTRID), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONGETTRUSTRID, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONGETTRUSTRID, - (ndr_print_function_t) ndr_print_netr_NETRLOGONGETTRUSTRID, + "netr_LogonGetTrustRid", + sizeof(struct netr_LogonGetTrustRid), + (ndr_push_flags_fn_t) ndr_push_netr_LogonGetTrustRid, + (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetTrustRid, + (ndr_print_function_t) ndr_print_netr_LogonGetTrustRid, false, }, { @@ -14526,11 +14754,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_DSRDEREGISTERDNSHOSTRECORDS", - sizeof(struct netr_DSRDEREGISTERDNSHOSTRECORDS), - (ndr_push_flags_fn_t) ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS, - (ndr_pull_flags_fn_t) ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS, - (ndr_print_function_t) ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS, + "netr_DsrDeregisterDNSHostRecords", + sizeof(struct netr_DsrDeregisterDNSHostRecords), + (ndr_push_flags_fn_t) ndr_push_netr_DsrDeregisterDNSHostRecords, + (ndr_pull_flags_fn_t) ndr_pull_netr_DsrDeregisterDNSHostRecords, + (ndr_print_function_t) ndr_print_netr_DsrDeregisterDNSHostRecords, false, }, { diff --git a/source3/librpc/gen_ndr/ndr_netlogon.h b/source3/librpc/gen_ndr/ndr_netlogon.h index c2fd0655d8..9a2eea8eff 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.h +++ b/source3/librpc/gen_ndr/ndr_netlogon.h @@ -57,7 +57,7 @@ extern const struct ndr_interface_table ndr_table_netlogon; #define NDR_NETR_NETRLOGONSETSERVICEBITS (0x16) -#define NDR_NETR_NETRLOGONGETTRUSTRID (0x17) +#define NDR_NETR_LOGONGETTRUSTRID (0x17) #define NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST (0x18) @@ -109,6 +109,9 @@ extern const struct ndr_interface_table ndr_table_netlogon; void ndr_print_netr_UasInfo(struct ndr_print *ndr, const char *name, const struct netr_UasInfo *r); void ndr_print_netr_UasLogoffInfo(struct ndr_print *ndr, const char *name, const struct netr_UasLogoffInfo *r); void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name, const struct netr_AcctLockStr *r); +enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r); +enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r); void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *name, const struct netr_IdentityInfo *r); void ndr_print_netr_PasswordInfo(struct ndr_print *ndr, const char *name, const struct netr_PasswordInfo *r); void ndr_print_netr_ChallengeResponse(struct ndr_print *ndr, const char *name, const struct netr_ChallengeResponse *r); @@ -116,9 +119,6 @@ void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name, const s enum ndr_err_code ndr_push_netr_LogonLevel(struct ndr_push *ndr, int ndr_flags, const union netr_LogonLevel *r); enum ndr_err_code ndr_pull_netr_LogonLevel(struct ndr_pull *ndr, int ndr_flags, union netr_LogonLevel *r); void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, const union netr_LogonLevel *r); -enum ndr_err_code ndr_push_netr_GroupMembership(struct ndr_push *ndr, int ndr_flags, const struct netr_GroupMembership *r); -enum ndr_err_code ndr_pull_netr_GroupMembership(struct ndr_pull *ndr, int ndr_flags, struct netr_GroupMembership *r); -void ndr_print_netr_GroupMembership(struct ndr_print *ndr, const char *name, const struct netr_GroupMembership *r); enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r); enum ndr_err_code ndr_pull_netr_UserSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_UserSessionKey *r); void ndr_print_netr_UserSessionKey(struct ndr_print *ndr, const char *name, const struct netr_UserSessionKey *r); @@ -227,7 +227,7 @@ void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const cha void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r); void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r); void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r); -void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r); +void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r); void ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); void ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); void ndr_print_netr_ServerAuthenticate3(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate3 *r); @@ -245,7 +245,7 @@ void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char * void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r); void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonEx *r); void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r); -void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r); +void ndr_print_netr_DsrDeregisterDNSHostRecords(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrDeregisterDNSHostRecords *r); void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r); void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r); void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r); diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c index f407fcf954..adbe549df0 100644 --- a/source3/librpc/gen_ndr/ndr_samr.c +++ b/source3/librpc/gen_ndr/ndr_samr.c @@ -91,17 +91,17 @@ _PUBLIC_ void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *n { ndr_print_uint32(ndr, name, r); ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_NAME_ETC", USER_ACCESS_GET_NAME_ETC, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_LOCALE", USER_ACCESS_GET_LOCALE, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_LOC_COM", USER_ACCESS_SET_LOC_COM, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_LOGONINFO", USER_ACCESS_GET_LOGONINFO, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_ATTRIBUTES", USER_ACCESS_GET_ATTRIBUTES, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_ATTRIBUTES", USER_ACCESS_SET_ATTRIBUTES, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_CHANGE_PASSWORD", USER_ACCESS_CHANGE_PASSWORD, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_PASSWORD", USER_ACCESS_SET_PASSWORD, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_GROUPS", USER_ACCESS_GET_GROUPS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_GROUP_MEMBERSHIP", USER_ACCESS_GET_GROUP_MEMBERSHIP, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_CHANGE_GROUP_MEMBERSHIP", USER_ACCESS_CHANGE_GROUP_MEMBERSHIP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_NAME_ETC", SAMR_USER_ACCESS_GET_NAME_ETC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_LOCALE", SAMR_USER_ACCESS_GET_LOCALE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_LOC_COM", SAMR_USER_ACCESS_SET_LOC_COM, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_LOGONINFO", SAMR_USER_ACCESS_GET_LOGONINFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_ATTRIBUTES", SAMR_USER_ACCESS_GET_ATTRIBUTES, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_ATTRIBUTES", SAMR_USER_ACCESS_SET_ATTRIBUTES, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_CHANGE_PASSWORD", SAMR_USER_ACCESS_CHANGE_PASSWORD, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_PASSWORD", SAMR_USER_ACCESS_SET_PASSWORD, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_GROUPS", SAMR_USER_ACCESS_GET_GROUPS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP", SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP", SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP, r); ndr->depth--; } @@ -123,17 +123,17 @@ _PUBLIC_ void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char { ndr_print_uint32(ndr, name, r); ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_INFO_1", DOMAIN_ACCESS_LOOKUP_INFO_1, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_1", DOMAIN_ACCESS_SET_INFO_1, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_INFO_2", DOMAIN_ACCESS_LOOKUP_INFO_2, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_2", DOMAIN_ACCESS_SET_INFO_2, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_USER", DOMAIN_ACCESS_CREATE_USER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_GROUP", DOMAIN_ACCESS_CREATE_GROUP, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_ALIAS", DOMAIN_ACCESS_CREATE_ALIAS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_ALIAS", DOMAIN_ACCESS_LOOKUP_ALIAS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_ENUM_ACCOUNTS", DOMAIN_ACCESS_ENUM_ACCOUNTS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_OPEN_ACCOUNT", DOMAIN_ACCESS_OPEN_ACCOUNT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_3", DOMAIN_ACCESS_SET_INFO_3, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1", SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_1", SAMR_DOMAIN_ACCESS_SET_INFO_1, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2", SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_2", SAMR_DOMAIN_ACCESS_SET_INFO_2, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_USER", SAMR_DOMAIN_ACCESS_CREATE_USER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_GROUP", SAMR_DOMAIN_ACCESS_CREATE_GROUP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_ALIAS", SAMR_DOMAIN_ACCESS_CREATE_ALIAS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS", SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS", SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT", SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_3", SAMR_DOMAIN_ACCESS_SET_INFO_3, r); ndr->depth--; } @@ -155,11 +155,11 @@ _PUBLIC_ void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char * { ndr_print_uint32(ndr, name, r); ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_LOOKUP_INFO", GROUP_ACCESS_LOOKUP_INFO, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_SET_INFO", GROUP_ACCESS_SET_INFO, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_ADD_MEMBER", GROUP_ACCESS_ADD_MEMBER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_REMOVE_MEMBER", GROUP_ACCESS_REMOVE_MEMBER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_GET_MEMBERS", GROUP_ACCESS_GET_MEMBERS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_LOOKUP_INFO", SAMR_GROUP_ACCESS_LOOKUP_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_SET_INFO", SAMR_GROUP_ACCESS_SET_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_ADD_MEMBER", SAMR_GROUP_ACCESS_ADD_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_REMOVE_MEMBER", SAMR_GROUP_ACCESS_REMOVE_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_GET_MEMBERS", SAMR_GROUP_ACCESS_GET_MEMBERS, r); ndr->depth--; } @@ -181,11 +181,11 @@ _PUBLIC_ void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char * { ndr_print_uint32(ndr, name, r); ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_ADD_MEMBER", ALIAS_ACCESS_ADD_MEMBER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_REMOVE_MEMBER", ALIAS_ACCESS_REMOVE_MEMBER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_GET_MEMBERS", ALIAS_ACCESS_GET_MEMBERS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_LOOKUP_INFO", ALIAS_ACCESS_LOOKUP_INFO, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_SET_INFO", ALIAS_ACCESS_SET_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_ADD_MEMBER", SAMR_ALIAS_ACCESS_ADD_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_REMOVE_MEMBER", SAMR_ALIAS_ACCESS_REMOVE_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_GET_MEMBERS", SAMR_ALIAS_ACCESS_GET_MEMBERS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_LOOKUP_INFO", SAMR_ALIAS_ACCESS_LOOKUP_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_SET_INFO", SAMR_ALIAS_ACCESS_SET_INFO, r); ndr->depth--; } @@ -6409,10 +6409,10 @@ static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); - if (r->out.sam == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.sam)); + if (r->out.sam) { + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); } - NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); if (r->out.num_entries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -6424,6 +6424,7 @@ static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int flags, struct samr_EnumDomainUsers *r) { + uint32_t _ptr_sam; TALLOC_CTX *_mem_save_domain_handle_0; TALLOC_CTX *_mem_save_resume_handle_0; TALLOC_CTX *_mem_save_sam_0; @@ -6449,8 +6450,6 @@ static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size)); NDR_PULL_ALLOC(ndr, r->out.resume_handle); *r->out.resume_handle = *r->in.resume_handle; - NDR_PULL_ALLOC(ndr, r->out.sam); - ZERO_STRUCTP(r->out.sam); NDR_PULL_ALLOC(ndr, r->out.num_entries); ZERO_STRUCTP(r->out.num_entries); } @@ -6462,13 +6461,18 @@ static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam)); + if (_ptr_sam) { NDR_PULL_ALLOC(ndr, r->out.sam); + } else { + r->out.sam = NULL; + } + if (r->out.sam) { + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, 0); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, 0); } - _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.num_entries); } @@ -6512,7 +6516,9 @@ _PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char * ndr->depth--; ndr_print_ptr(ndr, "sam", r->out.sam); ndr->depth++; - ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + if (r->out.sam) { + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + } ndr->depth--; ndr_print_ptr(ndr, "num_entries", r->out.num_entries); ndr->depth++; diff --git a/source3/librpc/gen_ndr/ndr_security.c b/source3/librpc/gen_ndr/ndr_security.c new file mode 100644 index 0000000000..a6ee1a5ddb --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_security.c @@ -0,0 +1,1028 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_security.h" + +#include "librpc/gen_ndr/ndr_misc.h" +static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r) +{ + ndr_print_uint8(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r) +{ + const char *val = NULL; + + switch (r) { + case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break; + case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break; + case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break; + case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break; + case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break; + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break; + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break; + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break; + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_security_ace_object_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_type *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_OBJECT_TYPE_PRESENT: + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type)); + break; + + default: + break; + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_OBJECT_TYPE_PRESENT: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case SEC_ACE_OBJECT_TYPE_PRESENT: { + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type)); + break; } + + default: { + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case SEC_ACE_OBJECT_TYPE_PRESENT: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "security_ace_object_type"); + switch (level) { + case SEC_ACE_OBJECT_TYPE_PRESENT: + ndr_print_GUID(ndr, "type", &r->type); + break; + + default: + break; + + } +} + +static enum ndr_err_code ndr_push_security_ace_object_inherited_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_inherited_type *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type)); + break; + + default: + break; + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_object_inherited_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_inherited_type *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: { + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type)); + break; } + + default: { + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "security_ace_object_inherited_type"); + switch (level) { + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: + ndr_print_GUID(ndr, "inherited_type", &r->inherited_type); + break; + + default: + break; + + } +} + +static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT)); + NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)); + NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type)); + NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT)); + NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)); + NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type)); + NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r) +{ + ndr_print_struct(ndr, name, "security_ace_object"); + ndr->depth++; + ndr_print_security_ace_object_flags(ndr, "flags", r->flags); + ndr_print_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT); + ndr_print_security_ace_object_type(ndr, "type", &r->type); + ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT); + ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; + + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; + + default: + break; + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: + NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: { + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; } + + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: { + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; } + + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: { + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; } + + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: { + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); + break; } + + default: { + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: + NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "security_ace_object_ctr"); + switch (level) { + case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: + ndr_print_security_ace_object(ndr, "object", &r->object); + break; + + case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: + ndr_print_security_ace_object(ndr, "object", &r->object); + break; + + case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: + ndr_print_security_ace_object(ndr, "object", &r->object); + break; + + case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: + ndr_print_security_ace_object(ndr, "object", &r->object); + break; + + default: + break; + + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->flags))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type)); + NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->trustee)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type)); + NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->trustee)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r) +{ + ndr_print_struct(ndr, name, "security_ace"); + ndr->depth++; + ndr_print_security_ace_type(ndr, "type", r->type); + ndr_print_security_ace_flags(ndr, "flags", r->flags); + ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->flags):r->size); + ndr_print_uint32(ndr, "access_mask", r->access_mask); + ndr_print_set_switch_value(ndr, &r->object, r->type); + ndr_print_security_ace_object_ctr(ndr, "object", &r->object); + ndr_print_dom_sid(ndr, "trustee", &r->trustee); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r) +{ + const char *val = NULL; + + switch (r) { + case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break; + case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r) +{ + uint32_t cntr_aces_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->flags))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces)); + for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { + NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { + NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0])); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r) +{ + uint32_t cntr_aces_0; + TALLOC_CTX *_mem_save_aces_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces)); + if (r->num_aces < 0 || r->num_aces > 1000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces); + _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0); + for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { + NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0); + } + if (ndr_flags & NDR_BUFFERS) { + _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0); + for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { + NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r) +{ + uint32_t cntr_aces_0; + ndr_print_struct(ndr, name, "security_acl"); + ndr->depth++; + ndr_print_security_acl_revision(ndr, "revision", r->revision); + ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->flags):r->size); + ndr_print_uint32(ndr, "num_aces", r->num_aces); + ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces); + ndr->depth++; + for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_aces_0); + if (idx_0) { + ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r) +{ + const char *val = NULL; + + switch (r) { + case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r) +{ + ndr_print_uint16(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision)); + NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->owner_sid) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid)); + } + if (r->group_sid) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid)); + } + if (r->sacl) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl)); + NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl)); + } + if (r->dacl) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl)); + NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl)); + } + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r) +{ + uint32_t _ptr_owner_sid; + TALLOC_CTX *_mem_save_owner_sid_0; + uint32_t _ptr_group_sid; + TALLOC_CTX *_mem_save_group_sid_0; + uint32_t _ptr_sacl; + TALLOC_CTX *_mem_save_sacl_0; + uint32_t _ptr_dacl; + TALLOC_CTX *_mem_save_dacl_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision)); + NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid)); + if (_ptr_owner_sid) { + NDR_PULL_ALLOC(ndr, r->owner_sid); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid)); + } else { + r->owner_sid = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid)); + if (_ptr_group_sid) { + NDR_PULL_ALLOC(ndr, r->group_sid); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid)); + } else { + r->group_sid = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl)); + if (_ptr_sacl) { + NDR_PULL_ALLOC(ndr, r->sacl); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl)); + } else { + r->sacl = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl)); + if (_ptr_dacl) { + NDR_PULL_ALLOC(ndr, r->dacl); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl)); + } else { + r->dacl = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->owner_sid) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid)); + _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0); + ndr->offset = _relative_save_offset; + } + if (r->group_sid) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid)); + _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0); + ndr->offset = _relative_save_offset; + } + if (r->sacl) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl)); + _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0); + NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0); + ndr->offset = _relative_save_offset; + } + if (r->dacl) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl)); + _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0); + NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0); + ndr->offset = _relative_save_offset; + } + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r) +{ + ndr_print_struct(ndr, name, "security_descriptor"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); + ndr->depth++; + ndr_print_security_descriptor_revision(ndr, "revision", r->revision); + ndr_print_security_descriptor_type(ndr, "type", r->type); + ndr_print_ptr(ndr, "owner_sid", r->owner_sid); + ndr->depth++; + if (r->owner_sid) { + ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid); + } + ndr->depth--; + ndr_print_ptr(ndr, "group_sid", r->group_sid); + ndr->depth++; + if (r->group_sid) { + ndr_print_dom_sid(ndr, "group_sid", r->group_sid); + } + ndr->depth--; + ndr_print_ptr(ndr, "sacl", r->sacl); + ndr->depth++; + if (r->sacl) { + ndr_print_security_acl(ndr, "sacl", r->sacl); + } + ndr->depth--; + ndr_print_ptr(ndr, "dacl", r->dacl); + ndr->depth++; + if (r->dacl) { + ndr_print_security_acl(ndr, "dacl", r->dacl); + } + ndr->depth--; + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->flags))); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sd) { + { + struct ndr_push *_ndr_sd; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1)); + NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1)); + } + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r) +{ + uint32_t _ptr_sd; + TALLOC_CTX *_mem_save_sd_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size)); + if (r->sd_size < 0 || r->sd_size > 0x40000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd)); + if (_ptr_sd) { + NDR_PULL_ALLOC(ndr, r->sd); + } else { + r->sd = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sd) { + _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0); + { + struct ndr_pull *_ndr_sd; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1)); + NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1)); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r) +{ + ndr_print_struct(ndr, name, "sec_desc_buf"); + ndr->depth++; + ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd, ndr->flags):r->sd_size); + ndr_print_ptr(ndr, "sd", r->sd); + ndr->depth++; + if (r->sd) { + ndr_print_security_descriptor(ndr, "sd", r->sd); + } + ndr->depth--; + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r) +{ + uint32_t cntr_sids_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids)); + for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0])); + } + NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->user_sid) { + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid)); + } + if (r->group_sid) { + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid)); + } + for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) { + if (r->sids[cntr_sids_0]) { + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0])); + } + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r) +{ + uint32_t _ptr_user_sid; + TALLOC_CTX *_mem_save_user_sid_0; + uint32_t _ptr_group_sid; + TALLOC_CTX *_mem_save_group_sid_0; + uint32_t _ptr_sids; + uint32_t cntr_sids_0; + TALLOC_CTX *_mem_save_sids_0; + TALLOC_CTX *_mem_save_sids_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid)); + if (_ptr_user_sid) { + NDR_PULL_ALLOC(ndr, r->user_sid); + } else { + r->user_sid = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid)); + if (_ptr_group_sid) { + NDR_PULL_ALLOC(ndr, r->group_sid); + } else { + r->group_sid = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->sids)); + NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids)); + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0); + for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids)); + if (_ptr_sids) { + NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]); + } else { + r->sids[cntr_sids_0] = NULL; + } + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0); + NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask)); + if (r->sids) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids)); + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->user_sid) { + _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0); + } + if (r->group_sid) { + _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0); + } + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0); + for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) { + if (r->sids[cntr_sids_0]) { + _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0])); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0); + } + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r) +{ + uint32_t cntr_sids_0; + ndr_print_struct(ndr, name, "security_token"); + ndr->depth++; + ndr_print_ptr(ndr, "user_sid", r->user_sid); + ndr->depth++; + if (r->user_sid) { + ndr_print_dom_sid(ndr, "user_sid", r->user_sid); + } + ndr->depth--; + ndr_print_ptr(ndr, "group_sid", r->group_sid); + ndr->depth++; + if (r->group_sid) { + ndr_print_dom_sid(ndr, "group_sid", r->group_sid); + } + ndr->depth--; + ndr_print_uint32(ndr, "num_sids", r->num_sids); + ndr->print(ndr, "%s: ARRAY(%d)", "sids", r->num_sids); + ndr->depth++; + for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_sids_0); + if (idx_0) { + ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]); + ndr->depth++; + if (r->sids[cntr_sids_0]) { + ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]); + } + ndr->depth--; + free(idx_0); + } + } + ndr->depth--; + ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r); + ndr->depth--; +} + diff --git a/source3/librpc/gen_ndr/ndr_security.h b/source3/librpc/gen_ndr/ndr_security.h index 292e9011c6..79bfd78f51 100644 --- a/source3/librpc/gen_ndr/ndr_security.h +++ b/source3/librpc/gen_ndr/ndr_security.h @@ -1,2 +1,41 @@ -/* empty header to deal with pidl */ +/* header auto-generated by pidl */ +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/security.h" + +#ifndef _HEADER_NDR_security +#define _HEADER_NDR_security + +#define NDR_SECURITY_CALL_COUNT (0) +void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r); +void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r); +void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r); +void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r); +void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r); +void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r); +enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r); +enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r); +void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r); +size_t ndr_size_security_ace(const struct security_ace *r, int flags); +void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r); +enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r); +enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r); +void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r); +size_t ndr_size_security_acl(const struct security_acl *r, int flags); +void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r); +void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r); +enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r); +enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r); +void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r); +size_t ndr_size_security_descriptor(const struct security_descriptor *r, int flags); +enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r); +enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r); +void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r); +enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r); +enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r); +void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r); +enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r); +enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r); +#endif /* _HEADER_NDR_security */ diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 1dcc363742..f59d93764f 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -8,15 +8,10 @@ #ifndef _HEADER_netlogon #define _HEADER_netlogon -#define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED ( 0x002 ) -#define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT ( 0x020 ) -#define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT ( 0x800 ) #define NETLOGON_NEG_ARCFOUR ( 0x00000004 ) #define NETLOGON_NEG_128BIT ( 0x00004000 ) #define NETLOGON_NEG_SCHANNEL ( 0x40000000 ) #define DS_GFTI_UPDATE_TDO ( 0x1 ) -; - struct netr_UasInfo { const char *account_name;/* [unique,charset(UTF16)] */ uint32_t priv; @@ -47,6 +42,14 @@ struct netr_AcctLockStr { uint16_t *bindata;/* [unique,length_is(length/2),size_is(size/2)] */ }; +/* bitmap netr_LogonParameterControl */ +#define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED ( 0x00000002 ) +#define MSV1_0_UPDATE_LOGON_STATISTICS ( 0x00000004 ) +#define MSV1_0_RETURN_USER_PARAMETERS ( 0x00000008 ) +#define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT ( 0x00000020 ) +#define MSV1_0_RETURN_PROFILE_PATH ( 0x00000200 ) +#define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT ( 0x00000800 ) + struct netr_IdentityInfo { struct lsa_String domain_name; uint32_t parameter_control; @@ -80,11 +83,6 @@ union netr_LogonLevel { struct netr_NetworkInfo *network;/* [unique,case(2)] */ }/* [public,switch_type(uint16)] */; -struct netr_GroupMembership { - uint32_t rid; - uint32_t attributes; -}/* [public] */; - struct netr_UserSessionKey { uint8_t key[16]; }/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; @@ -106,8 +104,6 @@ struct netr_LMSessionKey { #define NETLOGON_PROFILE_PATH_RETURNED ( 0x00000400 ) #define NETLOGON_GRACE_LOGON ( 0x01000000 ) -; - struct netr_SamBaseInfo { NTTIME last_logon; NTTIME last_logoff; @@ -142,7 +138,7 @@ struct netr_SamInfo2 { struct netr_SidAttr { struct dom_sid2 *sid;/* [unique] */ - uint32_t attribute; + uint32_t attributes; }; struct netr_SamInfo3 { @@ -650,8 +646,6 @@ struct netr_Blob { #define DS_RETURN_DNS_NAME ( 0x40000000 ) #define DS_RETURN_FLAT_NAME ( 0x80000000 ) -; - enum netr_DsRGetDCNameInfo_AddressType #ifndef USE_UINT_ENUMS { @@ -680,8 +674,6 @@ enum netr_DsRGetDCNameInfo_AddressType #define DS_DNS_DOMAIN ( 0x40000000 ) #define DS_DNS_FOREST ( 0x80000000 ) -; - struct netr_DsRGetDCNameInfo { const char *dc_unc;/* [unique,charset(UTF16)] */ const char *dc_address;/* [unique,charset(UTF16)] */ @@ -763,8 +755,6 @@ struct netr_DsRAddress { #define NETR_TRUST_FLAG_NATIVE ( 0x00000010 ) #define NETR_TRUST_FLAG_INBOUND ( 0x00000020 ) -; - enum netr_TrustType #ifndef USE_UINT_ENUMS { @@ -791,8 +781,6 @@ enum netr_TrustType #define NETR_TRUST_ATTRIBUTE_WITHIN_FOREST ( 0x00000020 ) #define NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL ( 0x00000040 ) -; - struct netr_DomainTrust { const char *netbios_name;/* [unique,charset(UTF16)] */ const char *dns_name;/* [unique,charset(UTF16)] */ @@ -1212,8 +1200,14 @@ struct netr_NETRLOGONSETSERVICEBITS { }; -struct netr_NETRLOGONGETTRUSTRID { +struct netr_LogonGetTrustRid { + struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *domain_name;/* [unique,charset(UTF16)] */ + } in; + struct { + uint32_t *rid;/* [ref] */ WERROR result; } out; @@ -1266,7 +1260,7 @@ struct netr_DsRGetDCNameEx { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [ref] */ + struct netr_DsRGetDCNameInfo **info;/* [ref] */ WERROR result; } out; @@ -1376,7 +1370,7 @@ struct netr_DsRGetDCNameEx2 { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [ref] */ + struct netr_DsRGetDCNameInfo **info;/* [ref] */ WERROR result; } out; @@ -1459,14 +1453,22 @@ struct netr_DsrEnumerateDomainTrusts { } in; struct { - struct netr_DomainTrustList **trusts;/* [ref] */ + struct netr_DomainTrustList *trusts;/* [ref] */ WERROR result; } out; }; -struct netr_DSRDEREGISTERDNSHOSTRECORDS { +struct netr_DsrDeregisterDNSHostRecords { + struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *domain;/* [unique,charset(UTF16)] */ + struct GUID *domain_guid;/* [unique] */ + struct GUID *dsa_guid;/* [unique] */ + const char *dns_host;/* [ref,charset(UTF16)] */ + } in; + struct { WERROR result; } out; diff --git a/source3/librpc/gen_ndr/samr.h b/source3/librpc/gen_ndr/samr.h index a512a64380..c6a68e8bd5 100644 --- a/source3/librpc/gen_ndr/samr.h +++ b/source3/librpc/gen_ndr/samr.h @@ -9,8 +9,6 @@ #define _HEADER_samr #define SAMR_ENUM_USERS_MULTIPLIER ( 54 ) -; - /* bitmap samr_AcctFlags */ #define ACB_DISABLED ( 0x00000001 ) #define ACB_HOMDIRREQ ( 0x00000002 ) @@ -32,8 +30,6 @@ #define ACB_PW_EXPIRED ( 0x00020000 ) #define ACB_NO_AUTH_DATA_REQD ( 0x00080000 ) -; - /* bitmap samr_ConnectAccessMask */ #define SAMR_ACCESS_CONNECT_TO_SERVER ( 0x00000001 ) #define SAMR_ACCESS_SHUTDOWN_SERVER ( 0x00000002 ) @@ -42,55 +38,45 @@ #define SAMR_ACCESS_ENUM_DOMAINS ( 0x00000010 ) #define SAMR_ACCESS_OPEN_DOMAIN ( 0x00000020 ) -; - /* bitmap samr_UserAccessMask */ -#define USER_ACCESS_GET_NAME_ETC ( 0x00000001 ) -#define USER_ACCESS_GET_LOCALE ( 0x00000002 ) -#define USER_ACCESS_SET_LOC_COM ( 0x00000004 ) -#define USER_ACCESS_GET_LOGONINFO ( 0x00000008 ) -#define USER_ACCESS_GET_ATTRIBUTES ( 0x00000010 ) -#define USER_ACCESS_SET_ATTRIBUTES ( 0x00000020 ) -#define USER_ACCESS_CHANGE_PASSWORD ( 0x00000040 ) -#define USER_ACCESS_SET_PASSWORD ( 0x00000080 ) -#define USER_ACCESS_GET_GROUPS ( 0x00000100 ) -#define USER_ACCESS_GET_GROUP_MEMBERSHIP ( 0x00000200 ) -#define USER_ACCESS_CHANGE_GROUP_MEMBERSHIP ( 0x00000400 ) - -; +#define SAMR_USER_ACCESS_GET_NAME_ETC ( 0x00000001 ) +#define SAMR_USER_ACCESS_GET_LOCALE ( 0x00000002 ) +#define SAMR_USER_ACCESS_SET_LOC_COM ( 0x00000004 ) +#define SAMR_USER_ACCESS_GET_LOGONINFO ( 0x00000008 ) +#define SAMR_USER_ACCESS_GET_ATTRIBUTES ( 0x00000010 ) +#define SAMR_USER_ACCESS_SET_ATTRIBUTES ( 0x00000020 ) +#define SAMR_USER_ACCESS_CHANGE_PASSWORD ( 0x00000040 ) +#define SAMR_USER_ACCESS_SET_PASSWORD ( 0x00000080 ) +#define SAMR_USER_ACCESS_GET_GROUPS ( 0x00000100 ) +#define SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP ( 0x00000200 ) +#define SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP ( 0x00000400 ) /* bitmap samr_DomainAccessMask */ -#define DOMAIN_ACCESS_LOOKUP_INFO_1 ( 0x00000001 ) -#define DOMAIN_ACCESS_SET_INFO_1 ( 0x00000002 ) -#define DOMAIN_ACCESS_LOOKUP_INFO_2 ( 0x00000004 ) -#define DOMAIN_ACCESS_SET_INFO_2 ( 0x00000008 ) -#define DOMAIN_ACCESS_CREATE_USER ( 0x00000010 ) -#define DOMAIN_ACCESS_CREATE_GROUP ( 0x00000020 ) -#define DOMAIN_ACCESS_CREATE_ALIAS ( 0x00000040 ) -#define DOMAIN_ACCESS_LOOKUP_ALIAS ( 0x00000080 ) -#define DOMAIN_ACCESS_ENUM_ACCOUNTS ( 0x00000100 ) -#define DOMAIN_ACCESS_OPEN_ACCOUNT ( 0x00000200 ) -#define DOMAIN_ACCESS_SET_INFO_3 ( 0x00000400 ) - -; +#define SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 ( 0x00000001 ) +#define SAMR_DOMAIN_ACCESS_SET_INFO_1 ( 0x00000002 ) +#define SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 ( 0x00000004 ) +#define SAMR_DOMAIN_ACCESS_SET_INFO_2 ( 0x00000008 ) +#define SAMR_DOMAIN_ACCESS_CREATE_USER ( 0x00000010 ) +#define SAMR_DOMAIN_ACCESS_CREATE_GROUP ( 0x00000020 ) +#define SAMR_DOMAIN_ACCESS_CREATE_ALIAS ( 0x00000040 ) +#define SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS ( 0x00000080 ) +#define SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS ( 0x00000100 ) +#define SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT ( 0x00000200 ) +#define SAMR_DOMAIN_ACCESS_SET_INFO_3 ( 0x00000400 ) /* bitmap samr_GroupAccessMask */ -#define GROUP_ACCESS_LOOKUP_INFO ( 0x00000001 ) -#define GROUP_ACCESS_SET_INFO ( 0x00000002 ) -#define GROUP_ACCESS_ADD_MEMBER ( 0x00000004 ) -#define GROUP_ACCESS_REMOVE_MEMBER ( 0x00000008 ) -#define GROUP_ACCESS_GET_MEMBERS ( 0x00000010 ) - -; +#define SAMR_GROUP_ACCESS_LOOKUP_INFO ( 0x00000001 ) +#define SAMR_GROUP_ACCESS_SET_INFO ( 0x00000002 ) +#define SAMR_GROUP_ACCESS_ADD_MEMBER ( 0x00000004 ) +#define SAMR_GROUP_ACCESS_REMOVE_MEMBER ( 0x00000008 ) +#define SAMR_GROUP_ACCESS_GET_MEMBERS ( 0x00000010 ) /* bitmap samr_AliasAccessMask */ -#define ALIAS_ACCESS_ADD_MEMBER ( 0x00000001 ) -#define ALIAS_ACCESS_REMOVE_MEMBER ( 0x00000002 ) -#define ALIAS_ACCESS_GET_MEMBERS ( 0x00000004 ) -#define ALIAS_ACCESS_LOOKUP_INFO ( 0x00000008 ) -#define ALIAS_ACCESS_SET_INFO ( 0x00000010 ) - -; +#define SAMR_ALIAS_ACCESS_ADD_MEMBER ( 0x00000001 ) +#define SAMR_ALIAS_ACCESS_REMOVE_MEMBER ( 0x00000002 ) +#define SAMR_ALIAS_ACCESS_GET_MEMBERS ( 0x00000004 ) +#define SAMR_ALIAS_ACCESS_LOOKUP_INFO ( 0x00000008 ) +#define SAMR_ALIAS_ACCESS_SET_INFO ( 0x00000010 ) struct samr_SamEntry { uint32_t idx; @@ -127,8 +113,6 @@ enum samr_Role #define DOMAIN_PASSWORD_STORE_CLEARTEXT ( 0x00000010 ) #define DOMAIN_REFUSE_PASSWORD_CHANGE ( 0x00000020 ) -; - struct samr_DomInfo1 { uint16_t min_password_length; uint16_t password_history_length; @@ -229,8 +213,6 @@ struct samr_Ids { #define SE_GROUP_RESOURCE ( 0x20000000 ) #define SE_GROUP_LOGON_ID ( 0xC0000000 ) -; - struct samr_GroupInfoAll { struct lsa_String name; uint32_t attributes; @@ -454,8 +436,6 @@ struct samr_UserInfo20 { #define SAMR_FIELD_SEC_DESC ( 0x10000000 ) #define SAMR_FIELD_OWF_PWD ( 0x20000000 ) -; - struct samr_UserInfo21 { NTTIME last_logon; NTTIME last_logoff; @@ -648,8 +628,6 @@ union samr_ConnectInfo { #define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH ( 0x00000010 ) #define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY ( 0x00000020 ) -; - enum samr_ValidatePasswordLevel #ifndef USE_UINT_ENUMS { @@ -946,7 +924,7 @@ struct samr_EnumDomainUsers { } in; struct { - struct samr_SamArray *sam;/* [ref] */ + struct samr_SamArray *sam;/* [unique] */ uint32_t *num_entries;/* [ref] */ uint32_t *resume_handle;/* [ref] */ NTSTATUS result; diff --git a/source3/librpc/gen_ndr/security.h b/source3/librpc/gen_ndr/security.h index 1c51af5b9c..f37b5d70f0 100644 --- a/source3/librpc/gen_ndr/security.h +++ b/source3/librpc/gen_ndr/security.h @@ -1 +1,326 @@ -#include "ndr/security.h" +/* header auto-generated by pidl */ + +#include <stdint.h> + +#include "librpc/gen_ndr/misc.h" +#define dom_sid2 dom_sid +#define dom_sid28 dom_sid +#ifndef _HEADER_security +#define _HEADER_security + +#define SEC_MASK_GENERIC ( 0xF0000000 ) +#define SEC_MASK_FLAGS ( 0x0F000000 ) +#define SEC_MASK_STANDARD ( 0x00FF0000 ) +#define SEC_MASK_SPECIFIC ( 0x0000FFFF ) +#define SEC_GENERIC_ALL ( 0x10000000 ) +#define SEC_GENERIC_EXECUTE ( 0x20000000 ) +#define SEC_GENERIC_WRITE ( 0x40000000 ) +#define SEC_GENERIC_READ ( 0x80000000 ) +#define SEC_FLAG_SYSTEM_SECURITY ( 0x01000000 ) +#define SEC_FLAG_MAXIMUM_ALLOWED ( 0x02000000 ) +#define SEC_STD_DELETE ( 0x00010000 ) +#define SEC_STD_READ_CONTROL ( 0x00020000 ) +#define SEC_STD_WRITE_DAC ( 0x00040000 ) +#define SEC_STD_WRITE_OWNER ( 0x00080000 ) +#define SEC_STD_SYNCHRONIZE ( 0x00100000 ) +#define SEC_STD_REQUIRED ( 0x000F0000 ) +#define SEC_STD_ALL ( 0x001F0000 ) +#define SEC_FILE_READ_DATA ( 0x00000001 ) +#define SEC_FILE_WRITE_DATA ( 0x00000002 ) +#define SEC_FILE_APPEND_DATA ( 0x00000004 ) +#define SEC_FILE_READ_EA ( 0x00000008 ) +#define SEC_FILE_WRITE_EA ( 0x00000010 ) +#define SEC_FILE_EXECUTE ( 0x00000020 ) +#define SEC_FILE_READ_ATTRIBUTE ( 0x00000080 ) +#define SEC_FILE_WRITE_ATTRIBUTE ( 0x00000100 ) +#define SEC_FILE_ALL ( 0x000001ff ) +#define SEC_DIR_LIST ( 0x00000001 ) +#define SEC_DIR_ADD_FILE ( 0x00000002 ) +#define SEC_DIR_ADD_SUBDIR ( 0x00000004 ) +#define SEC_DIR_READ_EA ( 0x00000008 ) +#define SEC_DIR_WRITE_EA ( 0x00000010 ) +#define SEC_DIR_TRAVERSE ( 0x00000020 ) +#define SEC_DIR_DELETE_CHILD ( 0x00000040 ) +#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 ) +#define SEC_DIR_WRITE_ATTRIBUTE ( 0x00000100 ) +#define SEC_REG_QUERY_VALUE ( 0x00000001 ) +#define SEC_REG_SET_VALUE ( 0x00000002 ) +#define SEC_REG_CREATE_SUBKEY ( 0x00000004 ) +#define SEC_REG_ENUM_SUBKEYS ( 0x00000008 ) +#define SEC_REG_NOTIFY ( 0x00000010 ) +#define SEC_REG_CREATE_LINK ( 0x00000020 ) +#define SEC_ADS_CREATE_CHILD ( 0x00000001 ) +#define SEC_ADS_DELETE_CHILD ( 0x00000002 ) +#define SEC_ADS_LIST ( 0x00000004 ) +#define SEC_ADS_SELF_WRITE ( 0x00000008 ) +#define SEC_ADS_READ_PROP ( 0x00000010 ) +#define SEC_ADS_WRITE_PROP ( 0x00000020 ) +#define SEC_ADS_DELETE_TREE ( 0x00000040 ) +#define SEC_ADS_LIST_OBJECT ( 0x00000080 ) +#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 ) +#define SEC_RIGHTS_FILE_READ ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA ) +#define SEC_RIGHTS_FILE_WRITE ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA ) +#define SEC_RIGHTS_FILE_EXECUTE ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE ) +#define SEC_RIGHTS_FILE_ALL ( SEC_STD_ALL|SEC_FILE_ALL ) +#define SEC_RIGHTS_DIR_READ ( SEC_RIGHTS_FILE_READ ) +#define SEC_RIGHTS_DIR_WRITE ( SEC_RIGHTS_FILE_WRITE ) +#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE ) +#define SEC_RIGHTS_DIR_ALL ( SEC_RIGHTS_FILE_ALL ) +#define SID_NULL ( "S-1-0-0" ) +#define NAME_WORLD ( "WORLD" ) +#define SID_WORLD_DOMAIN ( "S-1-1" ) +#define SID_WORLD ( "S-1-1-0" ) +#define SID_CREATOR_OWNER_DOMAIN ( "S-1-3" ) +#define SID_CREATOR_OWNER ( "S-1-3-0" ) +#define SID_CREATOR_GROUP ( "S-1-3-1" ) +#define NAME_NT_AUTHORITY ( "NT AUTHORITY" ) +#define SID_NT_AUTHORITY ( "S-1-5" ) +#define SID_NT_DIALUP ( "S-1-5-1" ) +#define SID_NT_NETWORK ( "S-1-5-2" ) +#define SID_NT_BATCH ( "S-1-5-3" ) +#define SID_NT_INTERACTIVE ( "S-1-5-4" ) +#define SID_NT_SERVICE ( "S-1-5-6" ) +#define SID_NT_ANONYMOUS ( "S-1-5-7" ) +#define SID_NT_PROXY ( "S-1-5-8" ) +#define SID_NT_ENTERPRISE_DCS ( "S-1-5-9" ) +#define SID_NT_SELF ( "S-1-5-10" ) +#define SID_NT_AUTHENTICATED_USERS ( "S-1-5-11" ) +#define SID_NT_RESTRICTED ( "S-1-5-12" ) +#define SID_NT_TERMINAL_SERVER_USERS ( "S-1-5-13" ) +#define SID_NT_REMOTE_INTERACTIVE ( "S-1-5-14" ) +#define SID_NT_THIS_ORGANISATION ( "S-1-5-15" ) +#define SID_NT_SYSTEM ( "S-1-5-18" ) +#define SID_NT_LOCAL_SERVICE ( "S-1-5-19" ) +#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" ) +#define NAME_BUILTIN ( "BUILTIN" ) +#define SID_BUILTIN ( "S-1-5-32" ) +#define SID_BUILTIN_ADMINISTRATORS ( "S-1-5-32-544" ) +#define SID_BUILTIN_USERS ( "S-1-5-32-545" ) +#define SID_BUILTIN_GUESTS ( "S-1-5-32-546" ) +#define SID_BUILTIN_POWER_USERS ( "S-1-5-32-547" ) +#define SID_BUILTIN_ACCOUNT_OPERATORS ( "S-1-5-32-548" ) +#define SID_BUILTIN_SERVER_OPERATORS ( "S-1-5-32-549" ) +#define SID_BUILTIN_PRINT_OPERATORS ( "S-1-5-32-550" ) +#define SID_BUILTIN_BACKUP_OPERATORS ( "S-1-5-32-551" ) +#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" ) +#define SID_BUILTIN_RAS_SERVERS ( "S-1-5-32-553" ) +#define SID_BUILTIN_PREW2K ( "S-1-5-32-554" ) +#define DOMAIN_RID_LOGON ( 9 ) +#define DOMAIN_RID_ADMINISTRATOR ( 500 ) +#define DOMAIN_RID_GUEST ( 501 ) +#define DOMAIN_RID_ADMINS ( 512 ) +#define DOMAIN_RID_USERS ( 513 ) +#define DOMAIN_RID_DOMAIN_MEMBERS ( 515 ) +#define DOMAIN_RID_DCS ( 516 ) +#define DOMAIN_RID_CERT_ADMINS ( 517 ) +#define DOMAIN_RID_SCHEMA_ADMINS ( 518 ) +#define DOMAIN_RID_ENTERPRISE_ADMINS ( 519 ) +#define NT4_ACL_REVISION ( SECURITY_ACL_REVISION_NT4 ) +#define SD_REVISION ( SECURITY_DESCRIPTOR_REVISION_1 ) +enum sec_privilege +#ifndef USE_UINT_ENUMS + { + SEC_PRIV_SECURITY=1, + SEC_PRIV_BACKUP=2, + SEC_PRIV_RESTORE=3, + SEC_PRIV_SYSTEMTIME=4, + SEC_PRIV_SHUTDOWN=5, + SEC_PRIV_REMOTE_SHUTDOWN=6, + SEC_PRIV_TAKE_OWNERSHIP=7, + SEC_PRIV_DEBUG=8, + SEC_PRIV_SYSTEM_ENVIRONMENT=9, + SEC_PRIV_SYSTEM_PROFILE=10, + SEC_PRIV_PROFILE_SINGLE_PROCESS=11, + SEC_PRIV_INCREASE_BASE_PRIORITY=12, + SEC_PRIV_LOAD_DRIVER=13, + SEC_PRIV_CREATE_PAGEFILE=14, + SEC_PRIV_INCREASE_QUOTA=15, + SEC_PRIV_CHANGE_NOTIFY=16, + SEC_PRIV_UNDOCK=17, + SEC_PRIV_MANAGE_VOLUME=18, + SEC_PRIV_IMPERSONATE=19, + SEC_PRIV_CREATE_GLOBAL=20, + SEC_PRIV_ENABLE_DELEGATION=21, + SEC_PRIV_INTERACTIVE_LOGON=22, + SEC_PRIV_NETWORK_LOGON=23, + SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24 +} +#else + { __donnot_use_enum_sec_privilege=0x7FFFFFFF} +#define SEC_PRIV_SECURITY ( 1 ) +#define SEC_PRIV_BACKUP ( 2 ) +#define SEC_PRIV_RESTORE ( 3 ) +#define SEC_PRIV_SYSTEMTIME ( 4 ) +#define SEC_PRIV_SHUTDOWN ( 5 ) +#define SEC_PRIV_REMOTE_SHUTDOWN ( 6 ) +#define SEC_PRIV_TAKE_OWNERSHIP ( 7 ) +#define SEC_PRIV_DEBUG ( 8 ) +#define SEC_PRIV_SYSTEM_ENVIRONMENT ( 9 ) +#define SEC_PRIV_SYSTEM_PROFILE ( 10 ) +#define SEC_PRIV_PROFILE_SINGLE_PROCESS ( 11 ) +#define SEC_PRIV_INCREASE_BASE_PRIORITY ( 12 ) +#define SEC_PRIV_LOAD_DRIVER ( 13 ) +#define SEC_PRIV_CREATE_PAGEFILE ( 14 ) +#define SEC_PRIV_INCREASE_QUOTA ( 15 ) +#define SEC_PRIV_CHANGE_NOTIFY ( 16 ) +#define SEC_PRIV_UNDOCK ( 17 ) +#define SEC_PRIV_MANAGE_VOLUME ( 18 ) +#define SEC_PRIV_IMPERSONATE ( 19 ) +#define SEC_PRIV_CREATE_GLOBAL ( 20 ) +#define SEC_PRIV_ENABLE_DELEGATION ( 21 ) +#define SEC_PRIV_INTERACTIVE_LOGON ( 22 ) +#define SEC_PRIV_NETWORK_LOGON ( 23 ) +#define SEC_PRIV_REMOTE_INTERACTIVE_LOGON ( 24 ) +#endif +; + +/* bitmap security_ace_flags */ +#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 ) +#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 ) +#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 ) +#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 ) +#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 ) +#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f ) +#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 ) +#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 ) + +enum security_ace_type +#ifndef USE_UINT_ENUMS + { + SEC_ACE_TYPE_ACCESS_ALLOWED=0, + SEC_ACE_TYPE_ACCESS_DENIED=1, + SEC_ACE_TYPE_SYSTEM_AUDIT=2, + SEC_ACE_TYPE_SYSTEM_ALARM=3, + SEC_ACE_TYPE_ALLOWED_COMPOUND=4, + SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5, + SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6, + SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7, + SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8 +} +#else + { __donnot_use_enum_security_ace_type=0x7FFFFFFF} +#define SEC_ACE_TYPE_ACCESS_ALLOWED ( 0 ) +#define SEC_ACE_TYPE_ACCESS_DENIED ( 1 ) +#define SEC_ACE_TYPE_SYSTEM_AUDIT ( 2 ) +#define SEC_ACE_TYPE_SYSTEM_ALARM ( 3 ) +#define SEC_ACE_TYPE_ALLOWED_COMPOUND ( 4 ) +#define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT ( 5 ) +#define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT ( 6 ) +#define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT ( 7 ) +#define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT ( 8 ) +#endif +; + +/* bitmap security_ace_object_flags */ +#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 ) +#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 ) + +union security_ace_object_type { + struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */ +}/* [nodiscriminant] */; + +union security_ace_object_inherited_type { + struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */ +}/* [nodiscriminant] */; + +struct security_ace_object { + uint32_t flags; + union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */ + union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */ +}; + +union security_ace_object_ctr { + struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */ +}/* [nodiscriminant] */; + +struct security_ace { + enum security_ace_type type; + uint8_t flags; + uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */ + uint32_t access_mask; + union security_ace_object_ctr object;/* [switch_is(type)] */ + struct dom_sid trustee; +}/* [gensize,public,nosize] */; + +enum security_acl_revision +#ifndef USE_UINT_ENUMS + { + SECURITY_ACL_REVISION_NT4=2, + SECURITY_ACL_REVISION_ADS=4 +} +#else + { __donnot_use_enum_security_acl_revision=0x7FFFFFFF} +#define SECURITY_ACL_REVISION_NT4 ( 2 ) +#define SECURITY_ACL_REVISION_ADS ( 4 ) +#endif +; + +struct security_acl { + enum security_acl_revision revision; + uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */ + uint32_t num_aces;/* [range(0 1000)] */ + struct security_ace *aces; +}/* [gensize,public,nosize] */; + +enum security_descriptor_revision +#ifndef USE_UINT_ENUMS + { + SECURITY_DESCRIPTOR_REVISION_1=1 +} +#else + { __donnot_use_enum_security_descriptor_revision=0x7FFFFFFF} +#define SECURITY_DESCRIPTOR_REVISION_1 ( 1 ) +#endif +; + +/* bitmap security_descriptor_type */ +#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 ) +#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 ) +#define SEC_DESC_DACL_PRESENT ( 0x0004 ) +#define SEC_DESC_DACL_DEFAULTED ( 0x0008 ) +#define SEC_DESC_SACL_PRESENT ( 0x0010 ) +#define SEC_DESC_SACL_DEFAULTED ( 0x0020 ) +#define SEC_DESC_DACL_TRUSTED ( 0x0040 ) +#define SEC_DESC_SERVER_SECURITY ( 0x0080 ) +#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 ) +#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 ) +#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 ) +#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 ) +#define SEC_DESC_DACL_PROTECTED ( 0x1000 ) +#define SEC_DESC_SACL_PROTECTED ( 0x2000 ) +#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 ) +#define SEC_DESC_SELF_RELATIVE ( 0x8000 ) + +struct security_descriptor { + enum security_descriptor_revision revision; + uint16_t type; + struct dom_sid *owner_sid;/* [relative] */ + struct dom_sid *group_sid;/* [relative] */ + struct security_acl *sacl;/* [relative] */ + struct security_acl *dacl;/* [relative] */ +}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */; + +struct sec_desc_buf { + uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */ + struct security_descriptor *sd;/* [unique,subcontext(4)] */ +}/* [public] */; + +struct security_token { + struct dom_sid *user_sid;/* [unique] */ + struct dom_sid *group_sid;/* [unique] */ + uint32_t num_sids; + struct dom_sid **sids;/* [unique,size_is(num_sids)] */ + uint64_t privilege_mask; +}/* [public] */; + +/* bitmap security_secinfo */ +#define SECINFO_OWNER ( 0x00000001 ) +#define SECINFO_GROUP ( 0x00000002 ) +#define SECINFO_DACL ( 0x00000004 ) +#define SECINFO_SACL ( 0x00000008 ) +#define SECINFO_UNPROTECTED_SACL ( 0x10000000 ) +#define SECINFO_UNPROTECTED_DACL ( 0x20000000 ) +#define SECINFO_PROTECTED_SACL ( 0x40000000 ) +#define SECINFO_PROTECTED_DACL ( 0x80000000 ) + +#endif /* _HEADER_security */ diff --git a/source3/librpc/gen_ndr/srv_dssetup.c b/source3/librpc/gen_ndr/srv_dssetup.c new file mode 100644 index 0000000000..9043566718 --- /dev/null +++ b/source3/librpc/gen_ndr/srv_dssetup.c @@ -0,0 +1,845 @@ +/* + * Unix SMB/CIFS implementation. + * server auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/srv_dssetup.h" + +static bool api_dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleGetPrimaryDomainInformation *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION]; + + r = talloc(NULL, struct dssetup_DsRoleGetPrimaryDomainInformation); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union dssetup_DsRoleInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _dssetup_DsRoleGetPrimaryDomainInformation(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleDnsNameToFlatName(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleDnsNameToFlatName *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME]; + + r = talloc(NULL, struct dssetup_DsRoleDnsNameToFlatName); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDnsNameToFlatName, r); + } + + r->out.result = _dssetup_DsRoleDnsNameToFlatName(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDnsNameToFlatName, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleDcAsDc(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleDcAsDc *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDCASDC]; + + r = talloc(NULL, struct dssetup_DsRoleDcAsDc); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsDc, r); + } + + r->out.result = _dssetup_DsRoleDcAsDc(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsDc, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleDcAsReplica(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleDcAsReplica *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDCASREPLICA]; + + r = talloc(NULL, struct dssetup_DsRoleDcAsReplica); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsReplica, r); + } + + r->out.result = _dssetup_DsRoleDcAsReplica(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsReplica, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleDemoteDc(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleDemoteDc *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDEMOTEDC]; + + r = talloc(NULL, struct dssetup_DsRoleDemoteDc); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleDemoteDc, r); + } + + r->out.result = _dssetup_DsRoleDemoteDc(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDemoteDc, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleGetDcOperationProgress(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleGetDcOperationProgress *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS]; + + r = talloc(NULL, struct dssetup_DsRoleGetDcOperationProgress); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationProgress, r); + } + + r->out.result = _dssetup_DsRoleGetDcOperationProgress(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationProgress, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleGetDcOperationResults(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleGetDcOperationResults *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS]; + + r = talloc(NULL, struct dssetup_DsRoleGetDcOperationResults); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationResults, r); + } + + r->out.result = _dssetup_DsRoleGetDcOperationResults(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationResults, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleCancel(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleCancel *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLECANCEL]; + + r = talloc(NULL, struct dssetup_DsRoleCancel); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleCancel, r); + } + + r->out.result = _dssetup_DsRoleCancel(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleCancel, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleServerSaveStateForUpgrade *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE]; + + r = talloc(NULL, struct dssetup_DsRoleServerSaveStateForUpgrade); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, r); + } + + r->out.result = _dssetup_DsRoleServerSaveStateForUpgrade(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleUpgradeDownlevelServer *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER]; + + r = talloc(NULL, struct dssetup_DsRoleUpgradeDownlevelServer); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, r); + } + + r->out.result = _dssetup_DsRoleUpgradeDownlevelServer(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct dssetup_DsRoleAbortDownlevelServerUpgrade *r; + + call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE]; + + r = talloc(NULL, struct dssetup_DsRoleAbortDownlevelServerUpgrade); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, r); + } + + r->out.result = _dssetup_DsRoleAbortDownlevelServerUpgrade(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + + +/* Tables */ +static struct api_struct api_dssetup_cmds[] = +{ + {"DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION", NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, api_dssetup_DsRoleGetPrimaryDomainInformation}, + {"DSSETUP_DSROLEDNSNAMETOFLATNAME", NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME, api_dssetup_DsRoleDnsNameToFlatName}, + {"DSSETUP_DSROLEDCASDC", NDR_DSSETUP_DSROLEDCASDC, api_dssetup_DsRoleDcAsDc}, + {"DSSETUP_DSROLEDCASREPLICA", NDR_DSSETUP_DSROLEDCASREPLICA, api_dssetup_DsRoleDcAsReplica}, + {"DSSETUP_DSROLEDEMOTEDC", NDR_DSSETUP_DSROLEDEMOTEDC, api_dssetup_DsRoleDemoteDc}, + {"DSSETUP_DSROLEGETDCOPERATIONPROGRESS", NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS, api_dssetup_DsRoleGetDcOperationProgress}, + {"DSSETUP_DSROLEGETDCOPERATIONRESULTS", NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS, api_dssetup_DsRoleGetDcOperationResults}, + {"DSSETUP_DSROLECANCEL", NDR_DSSETUP_DSROLECANCEL, api_dssetup_DsRoleCancel}, + {"DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE", NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE, api_dssetup_DsRoleServerSaveStateForUpgrade}, + {"DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER", NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER, api_dssetup_DsRoleUpgradeDownlevelServer}, + {"DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE", NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE, api_dssetup_DsRoleAbortDownlevelServerUpgrade}, +}; + +void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns) +{ + *fns = api_dssetup_cmds; + *n_fns = sizeof(api_dssetup_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_dssetup_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "dssetup", "dssetup", api_dssetup_cmds, sizeof(api_dssetup_cmds) / sizeof(struct api_struct)); +} diff --git a/source3/librpc/gen_ndr/srv_dssetup.h b/source3/librpc/gen_ndr/srv_dssetup.h new file mode 100644 index 0000000000..3233899eac --- /dev/null +++ b/source3/librpc/gen_ndr/srv_dssetup.h @@ -0,0 +1,17 @@ +#include "librpc/gen_ndr/ndr_dssetup.h" +#ifndef __SRV_DSSETUP__ +#define __SRV_DSSETUP__ +WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p, struct dssetup_DsRoleGetPrimaryDomainInformation *r); +WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, struct dssetup_DsRoleDnsNameToFlatName *r); +WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, struct dssetup_DsRoleDcAsDc *r); +WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, struct dssetup_DsRoleDcAsReplica *r); +WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, struct dssetup_DsRoleDemoteDc *r); +WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, struct dssetup_DsRoleGetDcOperationProgress *r); +WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, struct dssetup_DsRoleGetDcOperationResults *r); +WERROR _dssetup_DsRoleCancel(pipes_struct *p, struct dssetup_DsRoleCancel *r); +WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, struct dssetup_DsRoleServerSaveStateForUpgrade *r); +WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, struct dssetup_DsRoleUpgradeDownlevelServer *r); +WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); +void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_dssetup_init(void); +#endif /* __SRV_DSSETUP__ */ diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 421014e829..b9e6ae69b1 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -1866,18 +1866,18 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p) return true; } -static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) +static bool api_netr_LogonGetTrustRid(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRLOGONGETTRUSTRID *r; + struct netr_LogonGetTrustRid *r; - call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTRUSTRID]; + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETTRUSTRID]; - r = talloc(NULL, struct netr_NETRLOGONGETTRUSTRID); + r = talloc(NULL, struct netr_LogonGetTrustRid); if (r == NULL) { return false; } @@ -1901,10 +1901,17 @@ static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, r); + NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, r); } - r->out.result = _netr_NETRLOGONGETTRUSTRID(p, r); + ZERO_STRUCT(r->out); + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_LogonGetTrustRid(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -1913,7 +1920,7 @@ static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, r); + NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r); } push = ndr_push_init_ctx(r); @@ -2206,7 +2213,7 @@ static bool api_netr_DsRGetDCNameEx(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *); if (r->out.info == NULL) { talloc_free(r); return false; @@ -2766,7 +2773,7 @@ static bool api_netr_DsRGetDCNameEx2(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *); if (r->out.info == NULL) { talloc_free(r); return false; @@ -3246,7 +3253,7 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.trusts = talloc_zero(r, struct netr_DomainTrustList *); + r->out.trusts = talloc_zero(r, struct netr_DomainTrustList); if (r->out.trusts == NULL) { talloc_free(r); return false; @@ -3287,18 +3294,18 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p) return true; } -static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) +static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_DSRDEREGISTERDNSHOSTRECORDS *r; + struct netr_DsrDeregisterDNSHostRecords *r; call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS]; - r = talloc(NULL, struct netr_DSRDEREGISTERDNSHOSTRECORDS); + r = talloc(NULL, struct netr_DsrDeregisterDNSHostRecords); if (r == NULL) { return false; } @@ -3322,10 +3329,10 @@ static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r); + NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, r); } - r->out.result = _netr_DSRDEREGISTERDNSHOSTRECORDS(p, r); + r->out.result = _netr_DsrDeregisterDNSHostRecords(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -3334,7 +3341,7 @@ static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r); + NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, r); } push = ndr_push_init_ctx(r); @@ -3806,7 +3813,7 @@ static struct api_struct api_netlogon_cmds[] = {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName}, {"NETR_NETRLOGONDUMMYROUTINE1", NDR_NETR_NETRLOGONDUMMYROUTINE1, api_netr_NETRLOGONDUMMYROUTINE1}, {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS}, - {"NETR_NETRLOGONGETTRUSTRID", NDR_NETR_NETRLOGONGETTRUSTRID, api_netr_NETRLOGONGETTRUSTRID}, + {"NETR_LOGONGETTRUSTRID", NDR_NETR_LOGONGETTRUSTRID, api_netr_LogonGetTrustRid}, {"NETR_NETRLOGONCOMPUTESERVERDIGEST", NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, api_netr_NETRLOGONCOMPUTESERVERDIGEST}, {"NETR_NETRLOGONCOMPUTECLIENTDIGEST", NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, api_netr_NETRLOGONCOMPUTECLIENTDIGEST}, {"NETR_SERVERAUTHENTICATE3", NDR_NETR_SERVERAUTHENTICATE3, api_netr_ServerAuthenticate3}, @@ -3824,7 +3831,7 @@ static struct api_struct api_netlogon_cmds[] = {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DsrGetDcSiteCoverageW}, {"NETR_LOGONSAMLOGONEX", NDR_NETR_LOGONSAMLOGONEX, api_netr_LogonSamLogonEx}, {"NETR_DSRENUMERATEDOMAINTRUSTS", NDR_NETR_DSRENUMERATEDOMAINTRUSTS, api_netr_DsrEnumerateDomainTrusts}, - {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DSRDEREGISTERDNSHOSTRECORDS}, + {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DsrDeregisterDNSHostRecords}, {"NETR_SERVERTRUSTPASSWORDSGET", NDR_NETR_SERVERTRUSTPASSWORDSGET, api_netr_ServerTrustPasswordsGet}, {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DsRGetForestTrustInformation}, {"NETR_GETFORESTTRUSTINFORMATION", NDR_NETR_GETFORESTTRUSTINFORMATION, api_netr_GetForestTrustInformation}, diff --git a/source3/librpc/gen_ndr/srv_netlogon.h b/source3/librpc/gen_ndr/srv_netlogon.h index dc91cf5c0c..085672d91d 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.h +++ b/source3/librpc/gen_ndr/srv_netlogon.h @@ -24,7 +24,7 @@ WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, struct netr_NetrEnumer WERROR _netr_DsRGetDCName(pipes_struct *p, struct netr_DsRGetDCName *r); WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, struct netr_NETRLOGONDUMMYROUTINE1 *r); WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, struct netr_NETRLOGONSETSERVICEBITS *r); -WERROR _netr_NETRLOGONGETTRUSTRID(pipes_struct *p, struct netr_NETRLOGONGETTRUSTRID *r); +WERROR _netr_LogonGetTrustRid(pipes_struct *p, struct netr_LogonGetTrustRid *r); WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, struct netr_ServerAuthenticate3 *r); @@ -42,7 +42,7 @@ WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, struct netr_DsRAddressToS WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, struct netr_DsrGetDcSiteCoverageW *r); NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, struct netr_LogonSamLogonEx *r); WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, struct netr_DsrEnumerateDomainTrusts *r); -WERROR _netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p, struct netr_DSRDEREGISTERDNSHOSTRECORDS *r); +WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, struct netr_DsrDeregisterDNSHostRecords *r); NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, struct netr_ServerTrustPasswordsGet *r); WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, struct netr_DsRGetForestTrustInformation *r); WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTrustInformation *r); diff --git a/source3/librpc/gen_ndr/srvsvc.h b/source3/librpc/gen_ndr/srvsvc.h index bc167bb31c..6e6c7829a0 100644 --- a/source3/librpc/gen_ndr/srvsvc.h +++ b/source3/librpc/gen_ndr/srvsvc.h @@ -11,10 +11,6 @@ #define STYPE_HIDDEN ( 0x80000000 ) #define SHARE_1005_CSC_POLICY_MASK ( 0x00000030 ) #define SHARE_1005_CSC_POLICY_SHIFT ( 4 ) -; - -; - struct srvsvc_NetCharDevInfo0 { const char *device;/* [unique,charset(UTF16)] */ }; @@ -325,8 +321,6 @@ struct srvsvc_NetShareCtr1004 { #define SHARE_1005_IN_DFS ( 0x00000001 ) #define SHARE_1005_DFS_ROOT ( 0x00000002 ) -; - struct srvsvc_NetShareInfo1005 { uint32_t dfs_flags; }; diff --git a/source3/librpc/gen_ndr/svcctl.h b/source3/librpc/gen_ndr/svcctl.h index f0e476c105..7314be0a33 100644 --- a/source3/librpc/gen_ndr/svcctl.h +++ b/source3/librpc/gen_ndr/svcctl.h @@ -68,8 +68,6 @@ struct ENUM_SERVICE_STATUS { #define SV_TYPE_LOCAL_LIST_ONLY ( 0x40000000 ) #define SV_TYPE_DOMAIN_ENUM ( 0x80000000 ) -; - enum SERVICE_CONTROL #ifndef USE_UINT_ENUMS { diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index 8c498963b6..5570b310cd 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -8,8 +8,6 @@ #ifndef _HEADER_winreg #define _HEADER_winreg -; - /* bitmap winreg_AccessMask */ #define KEY_QUERY_VALUE ( 0x00001 ) #define KEY_SET_VALUE ( 0x00002 ) @@ -20,8 +18,6 @@ #define KEY_WOW64_64KEY ( 0x00100 ) #define KEY_WOW64_32KEY ( 0x00200 ) -; - enum winreg_Type #ifndef USE_UINT_ENUMS { diff --git a/source3/librpc/gen_ndr/wkssvc.h b/source3/librpc/gen_ndr/wkssvc.h index b4df7c2d8f..cdbf851671 100644 --- a/source3/librpc/gen_ndr/wkssvc.h +++ b/source3/librpc/gen_ndr/wkssvc.h @@ -415,8 +415,6 @@ struct wkssvc_NetrWorkstationStatistics { /* bitmap wkssvc_renameflags */ #define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) -; - enum wkssvc_NetValidateNameType #ifndef USE_UINT_ENUMS { @@ -471,8 +469,6 @@ struct wkssvc_PasswordBuffer { #define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) #define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) -; - enum wkssvc_ComputerNameType #ifndef USE_UINT_ENUMS { diff --git a/source3/librpc/idl/dssetup.idl b/source3/librpc/idl/dssetup.idl new file mode 100644 index 0000000000..af6350cc43 --- /dev/null +++ b/source3/librpc/idl/dssetup.idl @@ -0,0 +1,101 @@ +/* + dssetup interface definition +*/ + +import "misc.idl"; + +[ + uuid("3919286a-b10c-11d0-9ba8-00c04fd92ef5"), + version(0.0), + endpoint("ncacn_np:[\\pipe\\lsarpc]", "ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + helpstring("Active Directory Setup") +] interface dssetup +{ + /**********************************************/ + /* Function 0x00 */ + + typedef enum { + DS_ROLE_STANDALONE_WORKSTATION = 0, + DS_ROLE_MEMBER_WORKSTATION = 1, + DS_ROLE_STANDALONE_SERVER = 2, + DS_ROLE_MEMBER_SERVER = 3, + DS_ROLE_BACKUP_DC = 4, + DS_ROLE_PRIMARY_DC = 5 + } dssetup_DsRole; + + typedef [bitmap32bit] bitmap { + DS_ROLE_PRIMARY_DS_RUNNING = 0x00000001, + DS_ROLE_PRIMARY_DS_MIXED_MODE = 0x00000002, + DS_ROLE_UPGRADE_IN_PROGRESS = 0x00000004, + DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT = 0x01000000 + } dssetup_DsRoleFlags; + + typedef struct { + dssetup_DsRole role; + dssetup_DsRoleFlags flags; + [charset(UTF16),string] uint16 *domain; + [charset(UTF16),string] uint16 *dns_domain; + [charset(UTF16),string] uint16 *forest; + GUID domain_guid; + } dssetup_DsRolePrimaryDomInfoBasic; + + typedef [v1_enum] enum { + DS_ROLE_NOT_UPGRADING = 0, + DS_ROLE_UPGRADING = 1 + } dssetup_DsUpgrade; + + typedef enum { + DS_ROLE_PREVIOUS_UNKNOWN = 0, + DS_ROLE_PREVIOUS_PRIMARY = 1, + DS_ROLE_PREVIOUS_BACKUP = 2 + } dssetup_DsPrevious; + + typedef struct { + dssetup_DsUpgrade upgrading; + dssetup_DsPrevious previous_role; + } dssetup_DsRoleUpgradeStatus; + + typedef enum { + DS_ROLE_OP_IDLE = 0, + DS_ROLE_OP_ACTIVE = 1, + DS_ROLE_OP_NEEDS_REBOOT = 2 + } dssetup_DsRoleOp; + + typedef struct { + dssetup_DsRoleOp status; + } dssetup_DsRoleOpStatus; + + typedef enum { + DS_ROLE_BASIC_INFORMATION = 1, + DS_ROLE_UPGRADE_STATUS = 2, + DS_ROLE_OP_STATUS = 3 + } dssetup_DsRoleInfoLevel; + + typedef [switch_type(dssetup_DsRoleInfoLevel)] union { + [case(DS_ROLE_BASIC_INFORMATION)] dssetup_DsRolePrimaryDomInfoBasic basic; + [case(DS_ROLE_UPGRADE_STATUS)] dssetup_DsRoleUpgradeStatus upgrade; + [case(DS_ROLE_OP_STATUS)] dssetup_DsRoleOpStatus opstatus; + } dssetup_DsRoleInfo; + + WERROR dssetup_DsRoleGetPrimaryDomainInformation( + [in] dssetup_DsRoleInfoLevel level, + [out,switch_is(level),unique] dssetup_DsRoleInfo *info + ); + + /* + w2k3 has removed all the calls below from their implementation. + These stubs are left here only as a way of documenting the names + of the calls in case they ever turn up on the wire. + */ + WERROR dssetup_DsRoleDnsNameToFlatName(); + WERROR dssetup_DsRoleDcAsDc(); + WERROR dssetup_DsRoleDcAsReplica(); + WERROR dssetup_DsRoleDemoteDc(); + WERROR dssetup_DsRoleGetDcOperationProgress(); + WERROR dssetup_DsRoleGetDcOperationResults(); + WERROR dssetup_DsRoleCancel(); + WERROR dssetup_DsRoleServerSaveStateForUpgrade(); + WERROR dssetup_DsRoleUpgradeDownlevelServer(); + WERROR dssetup_DsRoleAbortDownlevelServerUpgrade(); +} diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 51efebd6ab..f485f8e26e 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -19,6 +19,7 @@ import "lsa.idl", "samr.idl", "security.idl"; interface netlogon { typedef bitmap samr_AcctFlags samr_AcctFlags; + typedef bitmap samr_GroupAttrs samr_GroupAttrs; /*****************/ /* Function 0x00 */ @@ -86,13 +87,18 @@ interface netlogon [size_is(size/2),length_is(length/2)] uint16 *bindata; } netr_AcctLockStr; - const int MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x002; - const int MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x020; - const int MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x800; + typedef [public,bitmap32bit] bitmap { + MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x00000002, + MSV1_0_UPDATE_LOGON_STATISTICS = 0x00000004, + MSV1_0_RETURN_USER_PARAMETERS = 0x00000008, + MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x00000020, + MSV1_0_RETURN_PROFILE_PATH = 0x00000200, + MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x00000800 + } netr_LogonParameterControl; typedef struct { lsa_String domain_name; - uint32 parameter_control; /* see MSV1_0_* */ + netr_LogonParameterControl parameter_control; /* see MSV1_0_* */ uint32 logon_id_low; uint32 logon_id_high; lsa_String account_name; @@ -126,11 +132,6 @@ interface netlogon [case(6)] netr_NetworkInfo *network; } netr_LogonLevel; - typedef [public] struct { - uint32 rid; - uint32 attributes; - } netr_GroupMembership; - typedef [public,flag(NDR_PAHEX)] struct { uint8 key[16]; } netr_UserSessionKey; @@ -188,7 +189,7 @@ interface netlogon typedef struct { dom_sid2 *sid; - uint32 attribute; + samr_GroupAttrs attributes; } netr_SidAttr; typedef [public] struct { @@ -992,7 +993,11 @@ interface netlogon /****************/ /* Function 0x17 */ - WERROR netr_NETRLOGONGETTRUSTRID(); + WERROR netr_LogonGetTrustRid( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *domain_name, + [out,ref] uint32 *rid + ); /****************/ /* Function 0x18 */ @@ -1023,7 +1028,7 @@ interface netlogon [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, [in] netr_DsRGetDCName_flags flags, - [out,ref] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo **info ); /****************/ @@ -1156,7 +1161,7 @@ interface netlogon [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, [in] netr_DsRGetDCName_flags flags, - [out,ref] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo **info ); /****************/ @@ -1259,13 +1264,19 @@ interface netlogon WERROR netr_DsrEnumerateDomainTrusts( [in] [string,charset(UTF16)] uint16 *server_name, [in] netr_TrustFlags trust_flags, - [out,ref] netr_DomainTrustList **trusts + [out,ref] netr_DomainTrustList *trusts ); /****************/ /* Function 0x29 */ - WERROR netr_DSRDEREGISTERDNSHOSTRECORDS(); + WERROR netr_DsrDeregisterDNSHostRecords( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *domain, + [in] GUID *domain_guid, + [in] GUID *dsa_guid, + [in,ref] [string,charset(UTF16)] uint16 *dns_host + ); /****************/ /* Function 0x2a */ diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index baf61c6df3..2c4fef5a7d 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -51,47 +51,47 @@ import "misc.idl", "lsa.idl", "security.idl"; } samr_ConnectAccessMask; typedef [bitmap32bit] bitmap { - USER_ACCESS_GET_NAME_ETC = 0x00000001, - USER_ACCESS_GET_LOCALE = 0x00000002, - USER_ACCESS_SET_LOC_COM = 0x00000004, - USER_ACCESS_GET_LOGONINFO = 0x00000008, - USER_ACCESS_GET_ATTRIBUTES = 0x00000010, - USER_ACCESS_SET_ATTRIBUTES = 0x00000020, - USER_ACCESS_CHANGE_PASSWORD = 0x00000040, - USER_ACCESS_SET_PASSWORD = 0x00000080, - USER_ACCESS_GET_GROUPS = 0x00000100, - USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200, - USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400 + SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001, + SAMR_USER_ACCESS_GET_LOCALE = 0x00000002, + SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004, + SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008, + SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010, + SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020, + SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040, + SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080, + SAMR_USER_ACCESS_GET_GROUPS = 0x00000100, + SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200, + SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400 } samr_UserAccessMask; typedef [bitmap32bit] bitmap { - DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001, - DOMAIN_ACCESS_SET_INFO_1 = 0x00000002, - DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004, - DOMAIN_ACCESS_SET_INFO_2 = 0x00000008, - DOMAIN_ACCESS_CREATE_USER = 0x00000010, - DOMAIN_ACCESS_CREATE_GROUP = 0x00000020, - DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040, - DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080, - DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100, - DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200, - DOMAIN_ACCESS_SET_INFO_3 = 0x00000400 + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001, + SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002, + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004, + SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008, + SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010, + SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020, + SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040, + SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080, + SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100, + SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200, + SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400 } samr_DomainAccessMask; typedef [bitmap32bit] bitmap { - GROUP_ACCESS_LOOKUP_INFO = 0x00000001, - GROUP_ACCESS_SET_INFO = 0x00000002, - GROUP_ACCESS_ADD_MEMBER = 0x00000004, - GROUP_ACCESS_REMOVE_MEMBER = 0x00000008, - GROUP_ACCESS_GET_MEMBERS = 0x00000010 + SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001, + SAMR_GROUP_ACCESS_SET_INFO = 0x00000002, + SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004, + SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008, + SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010 } samr_GroupAccessMask; typedef [bitmap32bit] bitmap { - ALIAS_ACCESS_ADD_MEMBER = 0x00000001, - ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002, - ALIAS_ACCESS_GET_MEMBERS = 0x00000004, - ALIAS_ACCESS_LOOKUP_INFO = 0x00000008, - ALIAS_ACCESS_SET_INFO = 0x00000010 + SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001, + SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002, + SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004, + SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008, + SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010 } samr_AliasAccessMask; /******************/ @@ -349,7 +349,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,out,ref] uint32 *resume_handle, [in] samr_AcctFlags acct_flags, [in] uint32 max_size, - [out,ref] samr_SamArray *sam, + [out] samr_SamArray *sam, [out,ref] uint32 *num_entries ); diff --git a/source3/librpc/idl/security.idl b/source3/librpc/idl/security.idl index 929c6cc18a..c4c30e9b5a 100644 --- a/source3/librpc/idl/security.idl +++ b/source3/librpc/idl/security.idl @@ -4,9 +4,26 @@ security IDL structures */ +import "misc.idl"; + +/* + use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really + just a dom sid, but with the sub_auths represented as a conformant + array. As with all in-structure conformant arrays, the array length + is placed before the start of the structure. That's what gives rise + to the extra num_auths elemenent. We don't want the Samba code to + have to bother with such esoteric NDR details, so its easier to just + define it as a dom_sid and use pidl magic to make it all work. It + just means you need to mark a sid as a "dom_sid2" in the IDL when you + know it is of the conformant array variety +*/ +cpp_quote("#define dom_sid2 dom_sid") + +/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */ +cpp_quote("#define dom_sid28 dom_sid") + [ - pointer_default(unique), - depends(misc,security) + pointer_default(unique) ] interface security { @@ -213,16 +230,6 @@ interface security SEC_PRIV_REMOTE_INTERACTIVE_LOGON = 24 } sec_privilege; - - /* a domain SID. Note that unlike Samba3 this contains a pointer, - so you can't copy them using assignment */ - typedef [public,gensize,noprint,noejs,nosize] struct { - uint8 sid_rev_num; /**< SID revision number */ - [range(0,15)] int8 num_auths; /**< Number of sub-authorities */ - uint8 id_auth[6]; /**< Identifier Authority */ - uint32 sub_auths[num_auths]; - } dom_sid; - typedef [bitmap8bit] bitmap { SEC_ACE_FLAG_OBJECT_INHERIT = 0x01, SEC_ACE_FLAG_CONTAINER_INHERIT = 0x02, diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h index 9c8c401c10..a277a626c7 100644 --- a/source3/librpc/ndr/libndr.h +++ b/source3/librpc/ndr/libndr.h @@ -23,7 +23,7 @@ #define _PRINTF_ATTRIBUTE(a,b) #include "librpc/gen_ndr/misc.h" -#include "librpc/ndr/security.h" +#include "librpc/gen_ndr/security.h" /* this provides definitions for the libcli/rpc/ MSRPC library diff --git a/source3/librpc/ndr/ndr_sec_helper.c b/source3/librpc/ndr/ndr_sec_helper.c index d1938b9588..f8bad6ca61 100644 --- a/source3/librpc/ndr/ndr_sec_helper.c +++ b/source3/librpc/ndr/ndr_sec_helper.c @@ -89,818 +89,3 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d { ndr_print_dom_sid(ndr, name, sid); } - -static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r) -{ - NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r) -{ - uint8_t v; - NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r) -{ - ndr_print_uint8(ndr, name, r); - ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r); - ndr->depth--; -} - -static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r) -{ - NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r) -{ - uint8_t v; - NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); - *r = (enum security_ace_type)v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r) -{ - const char *val = NULL; - - switch (r) { - case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break; - case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break; - case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break; - case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break; - case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break; - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break; - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break; - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break; - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break; - } - ndr_print_enum(ndr, name, "ENUM", val, r); -} - -static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r) -{ - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) -{ - uint32_t v; - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r) -{ - ndr_print_uint32(ndr, name, r); - ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r); - ndr->depth--; -} - -static enum ndr_err_code ndr_push_security_ace_object_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_type *r) -{ - int level; - level = ndr_push_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_OBJECT_TYPE_PRESENT: - NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type)); - break; - - default: - break; - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_OBJECT_TYPE_PRESENT: - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r) -{ - int level; - level = ndr_pull_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_OBJECT_TYPE_PRESENT: { - NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type)); - break; } - - default: { - break; } - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_OBJECT_TYPE_PRESENT: - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r) -{ - int level; - level = ndr_print_get_switch_value(ndr, r); - ndr_print_union(ndr, name, level, "security_ace_object_type"); - switch (level) { - case SEC_ACE_OBJECT_TYPE_PRESENT: - ndr_print_GUID(ndr, "type", &r->type); - break; - - default: - break; - - } -} - -static enum ndr_err_code ndr_push_security_ace_object_inherited_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_inherited_type *r) -{ - int level; - level = ndr_push_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: - NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type)); - break; - - default: - break; - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_object_inherited_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_inherited_type *r) -{ - int level; - level = ndr_pull_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: { - NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type)); - break; } - - default: { - break; } - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r) -{ - int level; - level = ndr_print_get_switch_value(ndr, r); - ndr_print_union(ndr, name, level, "security_ace_object_inherited_type"); - switch (level) { - case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: - ndr_print_GUID(ndr, "inherited_type", &r->inherited_type); - break; - - default: - break; - - } -} - -static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags)); - NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT)); - NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type)); - NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)); - NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type)); - } - if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type)); - NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type)); - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags)); - NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT)); - NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type)); - NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)); - NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type)); - } - if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type)); - NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type)); - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r) -{ - ndr_print_struct(ndr, name, "security_ace_object"); - ndr->depth++; - ndr_print_security_ace_object_flags(ndr, "flags", r->flags); - ndr_print_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT); - ndr_print_security_ace_object_type(ndr, "type", &r->type); - ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT); - ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type); - ndr->depth--; -} - -static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r) -{ - int level; - level = ndr_push_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; - - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; - - default: - break; - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: - NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r) -{ - int level; - level = ndr_pull_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: { - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; } - - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: { - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; } - - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: { - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; } - - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: { - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object)); - break; } - - default: { - break; } - - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: - NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object)); - break; - - default: - break; - - } - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r) -{ - int level; - level = ndr_print_get_switch_value(ndr, r); - ndr_print_union(ndr, name, level, "security_ace_object_ctr"); - switch (level) { - case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: - ndr_print_security_ace_object(ndr, "object", &r->object); - break; - - case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: - ndr_print_security_ace_object(ndr, "object", &r->object); - break; - - case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: - ndr_print_security_ace_object(ndr, "object", &r->object); - break; - - case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: - ndr_print_security_ace_object(ndr, "object", &r->object); - break; - - default: - break; - - } -} - -enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type)); - NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r,ndr->flags))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask)); - NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type)); - NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); - NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee)); - } - if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type)); - NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask)); - NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type)); - NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); - NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee)); - } - if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r) -{ - ndr_print_struct(ndr, name, "security_ace"); - ndr->depth++; - ndr_print_security_ace_type(ndr, "type", r->type); - ndr_print_security_ace_flags(ndr, "flags", r->flags); - ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r,ndr->flags):r->size); - ndr_print_uint32(ndr, "access_mask", r->access_mask); - ndr_print_set_switch_value(ndr, &r->object, r->type); - ndr_print_security_ace_object_ctr(ndr, "object", &r->object); - ndr_print_dom_sid(ndr, "trustee", &r->trustee); - ndr->depth--; -} - -static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r) -{ - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r) -{ - uint16_t v; - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); - *r = (enum security_acl_revision)v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r) -{ - const char *val = NULL; - - switch (r) { - case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break; - case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break; - } - ndr_print_enum(ndr, name, "ENUM", val, r); -} - -enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r) -{ - uint32_t cntr_aces_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r,ndr->flags))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces)); - for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { - NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0])); - } - } - if (ndr_flags & NDR_BUFFERS) { - for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { - NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0])); - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r) -{ - uint32_t cntr_aces_0; - TALLOC_CTX *_mem_save_aces_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces)); - if (r->num_aces > 1000) { /* num_aces is unsigned */ - return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); - } - NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces); - _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0); - for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { - NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0); - } - if (ndr_flags & NDR_BUFFERS) { - _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0); - for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) { - NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0); - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r) -{ - uint32_t cntr_aces_0; - ndr_print_struct(ndr, name, "security_acl"); - ndr->depth++; - ndr_print_security_acl_revision(ndr, "revision", r->revision); - ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r,ndr->flags):r->size); - ndr_print_uint32(ndr, "num_aces", r->num_aces); - ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces); - ndr->depth++; - for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) { - char *idx_0=NULL; - asprintf(&idx_0, "[%d]", cntr_aces_0); - if (idx_0) { - ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]); - free(idx_0); - } - } - ndr->depth--; - ndr->depth--; -} - -static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r) -{ - NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r) -{ - uint8_t v; - NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); - *r = (enum security_descriptor_revision)v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r) -{ - const char *val = NULL; - - switch (r) { - case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break; - } - ndr_print_enum(ndr, name, "ENUM", val, r); -} - -static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r) -{ - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r) -{ - uint16_t v; - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r) -{ - ndr_print_uint16(ndr, name, r); - ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r); - ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r); - ndr->depth--; -} - -enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r) -{ - { - uint32_t _flags_save_STRUCT = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision)); - NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->owner_sid) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid)); - NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid)); - } - if (r->group_sid) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid)); - NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid)); - } - if (r->sacl) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl)); - NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl)); - } - if (r->dacl) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl)); - NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl)); - } - } - ndr->flags = _flags_save_STRUCT; - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r) -{ - uint32_t _ptr_owner_sid; - TALLOC_CTX *_mem_save_owner_sid_0; - uint32_t _ptr_group_sid; - TALLOC_CTX *_mem_save_group_sid_0; - uint32_t _ptr_sacl; - TALLOC_CTX *_mem_save_sacl_0; - uint32_t _ptr_dacl; - TALLOC_CTX *_mem_save_dacl_0; - { - uint32_t _flags_save_STRUCT = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision)); - NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid)); - if (_ptr_owner_sid) { - NDR_PULL_ALLOC(ndr, r->owner_sid); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid)); - } else { - r->owner_sid = NULL; - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid)); - if (_ptr_group_sid) { - NDR_PULL_ALLOC(ndr, r->group_sid); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid)); - } else { - r->group_sid = NULL; - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl)); - if (_ptr_sacl) { - NDR_PULL_ALLOC(ndr, r->sacl); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl)); - } else { - r->sacl = NULL; - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl)); - if (_ptr_dacl) { - NDR_PULL_ALLOC(ndr, r->dacl); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl)); - } else { - r->dacl = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->owner_sid) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid)); - _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0); - NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0); - ndr_pull_restore(ndr, &_relative_save); - } - if (r->group_sid) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid)); - _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0); - NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0); - ndr_pull_restore(ndr, &_relative_save); - } - if (r->sacl) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl)); - _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0); - NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0); - ndr_pull_restore(ndr, &_relative_save); - } - if (r->dacl) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl)); - _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0); - NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0); - ndr_pull_restore(ndr, &_relative_save); - } - } - ndr->flags = _flags_save_STRUCT; - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r) -{ - ndr_print_struct(ndr, name, "security_descriptor"); - { - uint32_t _flags_save_STRUCT = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); - ndr->depth++; - ndr_print_security_descriptor_revision(ndr, "revision", r->revision); - ndr_print_security_descriptor_type(ndr, "type", r->type); - ndr_print_ptr(ndr, "owner_sid", r->owner_sid); - ndr->depth++; - if (r->owner_sid) { - ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid); - } - ndr->depth--; - ndr_print_ptr(ndr, "group_sid", r->group_sid); - ndr->depth++; - if (r->group_sid) { - ndr_print_dom_sid(ndr, "group_sid", r->group_sid); - } - ndr->depth--; - ndr_print_ptr(ndr, "sacl", r->sacl); - ndr->depth++; - if (r->sacl) { - ndr_print_security_acl(ndr, "sacl", r->sacl); - } - ndr->depth--; - ndr_print_ptr(ndr, "dacl", r->dacl); - ndr->depth++; - if (r->dacl) { - ndr_print_security_acl(ndr, "dacl", r->dacl); - } - ndr->depth--; - ndr->depth--; - ndr->flags = _flags_save_STRUCT; - } -} - -enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r) -{ - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) -{ - uint32_t v; - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r) -{ - ndr_print_uint32(ndr, name, r); - ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r); - ndr->depth--; -} - diff --git a/source3/librpc/ndr/security.h b/source3/librpc/ndr/security.h deleted file mode 100644 index 99f7daf2bd..0000000000 --- a/source3/librpc/ndr/security.h +++ /dev/null @@ -1,257 +0,0 @@ -/* header auto-generated by pidl */ - -#ifndef _HEADER_security -#define _HEADER_security - -#define SEC_MASK_GENERIC ( 0xF0000000 ) -#define SEC_MASK_FLAGS ( 0x0F000000 ) -#define SEC_MASK_STANDARD ( 0x00FF0000 ) -#define SEC_MASK_SPECIFIC ( 0x0000FFFF ) -#define SEC_GENERIC_ALL ( 0x10000000 ) -#define SEC_GENERIC_EXECUTE ( 0x20000000 ) -#define SEC_GENERIC_WRITE ( 0x40000000 ) -#define SEC_GENERIC_READ ( 0x80000000 ) -#define SEC_FLAG_SYSTEM_SECURITY ( 0x01000000 ) -#define SEC_FLAG_MAXIMUM_ALLOWED ( 0x02000000 ) -#define SEC_STD_DELETE ( 0x00010000 ) -#define SEC_STD_READ_CONTROL ( 0x00020000 ) -#define SEC_STD_WRITE_DAC ( 0x00040000 ) -#define SEC_STD_WRITE_OWNER ( 0x00080000 ) -#define SEC_STD_SYNCHRONIZE ( 0x00100000 ) -#define SEC_STD_REQUIRED ( 0x000F0000 ) -#define SEC_STD_ALL ( 0x001F0000 ) -#define SEC_FILE_READ_DATA ( 0x00000001 ) -#define SEC_FILE_WRITE_DATA ( 0x00000002 ) -#define SEC_FILE_APPEND_DATA ( 0x00000004 ) -#define SEC_FILE_READ_EA ( 0x00000008 ) -#define SEC_FILE_WRITE_EA ( 0x00000010 ) -#define SEC_FILE_EXECUTE ( 0x00000020 ) -#define SEC_FILE_READ_ATTRIBUTE ( 0x00000080 ) -#define SEC_FILE_WRITE_ATTRIBUTE ( 0x00000100 ) -#define SEC_FILE_ALL ( 0x000001ff ) -#define SEC_DIR_LIST ( 0x00000001 ) -#define SEC_DIR_ADD_FILE ( 0x00000002 ) -#define SEC_DIR_ADD_SUBDIR ( 0x00000004 ) -#define SEC_DIR_READ_EA ( 0x00000008 ) -#define SEC_DIR_WRITE_EA ( 0x00000010 ) -#define SEC_DIR_TRAVERSE ( 0x00000020 ) -#define SEC_DIR_DELETE_CHILD ( 0x00000040 ) -#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 ) -#define SEC_DIR_WRITE_ATTRIBUTE ( 0x00000100 ) -#define SEC_REG_QUERY_VALUE ( 0x00000001 ) -#define SEC_REG_SET_VALUE ( 0x00000002 ) -#define SEC_REG_CREATE_SUBKEY ( 0x00000004 ) -#define SEC_REG_ENUM_SUBKEYS ( 0x00000008 ) -#define SEC_REG_NOTIFY ( 0x00000010 ) -#define SEC_REG_CREATE_LINK ( 0x00000020 ) -#define SEC_ADS_CREATE_CHILD ( 0x00000001 ) -#define SEC_ADS_DELETE_CHILD ( 0x00000002 ) -#define SEC_ADS_LIST ( 0x00000004 ) -#define SEC_ADS_SELF_WRITE ( 0x00000008 ) -#define SEC_ADS_READ_PROP ( 0x00000010 ) -#define SEC_ADS_WRITE_PROP ( 0x00000020 ) -#define SEC_ADS_DELETE_TREE ( 0x00000040 ) -#define SEC_ADS_LIST_OBJECT ( 0x00000080 ) -#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 ) -#define SEC_RIGHTS_FILE_READ ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA ) -#define SEC_RIGHTS_FILE_WRITE ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA ) -#define SEC_RIGHTS_FILE_EXECUTE ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE ) -#define SEC_RIGHTS_FILE_ALL ( SEC_STD_ALL|SEC_FILE_ALL ) -#define SEC_RIGHTS_DIR_READ ( SEC_RIGHTS_FILE_READ ) -#define SEC_RIGHTS_DIR_WRITE ( SEC_RIGHTS_FILE_WRITE ) -#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE ) -#define SEC_RIGHTS_DIR_ALL ( SEC_RIGHTS_FILE_ALL ) -#define SID_NULL ( "S-1-0-0" ) -#define SID_WORLD_DOMAIN ( "S-1-1" ) -#define SID_WORLD ( "S-1-1-0" ) -#define SID_CREATOR_OWNER_DOMAIN ( "S-1-3" ) -#define SID_CREATOR_OWNER ( "S-1-3-0" ) -#define SID_CREATOR_GROUP ( "S-1-3-1" ) -#define SID_NT_AUTHORITY ( "S-1-5" ) -#define SID_NT_DIALUP ( "S-1-5-1" ) -#define SID_NT_NETWORK ( "S-1-5-2" ) -#define SID_NT_BATCH ( "S-1-5-3" ) -#define SID_NT_INTERACTIVE ( "S-1-5-4" ) -#define SID_NT_SERVICE ( "S-1-5-6" ) -#define SID_NT_ANONYMOUS ( "S-1-5-7" ) -#define SID_NT_PROXY ( "S-1-5-8" ) -#define SID_NT_ENTERPRISE_DCS ( "S-1-5-9" ) -#define SID_NT_SELF ( "S-1-5-10" ) -#define SID_NT_AUTHENTICATED_USERS ( "S-1-5-11" ) -#define SID_NT_RESTRICTED ( "S-1-5-12" ) -#define SID_NT_TERMINAL_SERVER_USERS ( "S-1-5-13" ) -#define SID_NT_REMOTE_INTERACTIVE ( "S-1-5-14" ) -#define SID_NT_THIS_ORGANISATION ( "S-1-5-15" ) -#define SID_NT_SYSTEM ( "S-1-5-18" ) -#define SID_NT_LOCAL_SERVICE ( "S-1-5-19" ) -#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" ) -#define SID_BUILTIN ( "S-1-5-32" ) -#define SID_BUILTIN_ADMINISTRATORS ( "S-1-5-32-544" ) -#define SID_BUILTIN_USERS ( "S-1-5-32-545" ) -#define SID_BUILTIN_GUESTS ( "S-1-5-32-546" ) -#define SID_BUILTIN_POWER_USERS ( "S-1-5-32-547" ) -#define SID_BUILTIN_ACCOUNT_OPERATORS ( "S-1-5-32-548" ) -#define SID_BUILTIN_SERVER_OPERATORS ( "S-1-5-32-549" ) -#define SID_BUILTIN_PRINT_OPERATORS ( "S-1-5-32-550" ) -#define SID_BUILTIN_BACKUP_OPERATORS ( "S-1-5-32-551" ) -#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" ) -#define SID_BUILTIN_RAS_SERVERS ( "S-1-5-32-553" ) -#define SID_BUILTIN_PREW2K ( "S-1-5-32-554" ) -#define DOMAIN_RID_LOGON ( 9 ) -#define DOMAIN_RID_ADMINISTRATOR ( 500 ) -#define DOMAIN_RID_GUEST ( 501 ) -#define DOMAIN_RID_ADMINS ( 512 ) -#define DOMAIN_RID_USERS ( 513 ) -#define DOMAIN_RID_DCS ( 516 ) -#define DOMAIN_RID_CERT_ADMINS ( 517 ) -#define DOMAIN_RID_SCHEMA_ADMINS ( 518 ) -#define DOMAIN_RID_ENTERPRISE_ADMINS ( 519 ) -#define NT4_ACL_REVISION ( SECURITY_ACL_REVISION_NT4 ) -#define SD_REVISION ( SECURITY_DESCRIPTOR_REVISION_1 ) -enum sec_privilege { - SEC_PRIV_SECURITY=1, - SEC_PRIV_BACKUP=2, - SEC_PRIV_RESTORE=3, - SEC_PRIV_SYSTEMTIME=4, - SEC_PRIV_SHUTDOWN=5, - SEC_PRIV_REMOTE_SHUTDOWN=6, - SEC_PRIV_TAKE_OWNERSHIP=7, - SEC_PRIV_DEBUG=8, - SEC_PRIV_SYSTEM_ENVIRONMENT=9, - SEC_PRIV_SYSTEM_PROFILE=10, - SEC_PRIV_PROFILE_SINGLE_PROCESS=11, - SEC_PRIV_INCREASE_BASE_PRIORITY=12, - SEC_PRIV_LOAD_DRIVER=13, - SEC_PRIV_CREATE_PAGEFILE=14, - SEC_PRIV_INCREASE_QUOTA=15, - SEC_PRIV_CHANGE_NOTIFY=16, - SEC_PRIV_UNDOCK=17, - SEC_PRIV_MANAGE_VOLUME=18, - SEC_PRIV_IMPERSONATE=19, - SEC_PRIV_CREATE_GLOBAL=20, - SEC_PRIV_ENABLE_DELEGATION=21, - SEC_PRIV_INTERACTIVE_LOGON=22, - SEC_PRIV_NETWORK_LOGON=23, - SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24 -}; - -/* bitmap security_ace_flags */ -#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 ) -#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 ) -#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 ) -#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 ) -#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 ) -#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f ) -#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 ) -#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 ) - -enum security_ace_type { - SEC_ACE_TYPE_ACCESS_ALLOWED=0, - SEC_ACE_TYPE_ACCESS_DENIED=1, - SEC_ACE_TYPE_SYSTEM_AUDIT=2, - SEC_ACE_TYPE_SYSTEM_ALARM=3, - SEC_ACE_TYPE_ALLOWED_COMPOUND=4, - SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5, - SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6, - SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7, - SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8 -}; - -/* bitmap security_ace_object_flags */ -#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 ) -#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 ) - -union security_ace_object_type { - struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */ -}/* [nodiscriminant] */; - -union security_ace_object_inherited_type { - struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */ -}/* [nodiscriminant] */; - -struct security_ace_object { - uint32_t flags; - union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */ - union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */ -}; - -union security_ace_object_ctr { - struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */ -}/* [nodiscriminant] */; - -struct security_ace { - enum security_ace_type type; - uint8_t flags; - uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */ - uint32_t access_mask; - union security_ace_object_ctr object;/* [switch_is(type)] */ - struct dom_sid trustee; -}/* [gensize,public,nosize] */; - -enum security_acl_revision { - SECURITY_ACL_REVISION_NT4=2, - SECURITY_ACL_REVISION_ADS=4 -}; - -struct security_acl { - enum security_acl_revision revision; - uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */ - uint32_t num_aces;/* [range(0 1000)] */ - struct security_ace *aces; -}/* [gensize,public,nosize] */; - -enum security_descriptor_revision { - SECURITY_DESCRIPTOR_REVISION_1=1 -}; - -/* bitmap security_descriptor_type */ -#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 ) -#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 ) -#define SEC_DESC_DACL_PRESENT ( 0x0004 ) -#define SEC_DESC_DACL_DEFAULTED ( 0x0008 ) -#define SEC_DESC_SACL_PRESENT ( 0x0010 ) -#define SEC_DESC_SACL_DEFAULTED ( 0x0020 ) -#define SEC_DESC_DACL_TRUSTED ( 0x0040 ) -#define SEC_DESC_SERVER_SECURITY ( 0x0080 ) -#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 ) -#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 ) -#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 ) -#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 ) -#define SEC_DESC_DACL_PROTECTED ( 0x1000 ) -#define SEC_DESC_SACL_PROTECTED ( 0x2000 ) -#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 ) -#define SEC_DESC_SELF_RELATIVE ( 0x8000 ) - -struct security_descriptor { - enum security_descriptor_revision revision; - uint16_t type; - struct dom_sid *owner_sid;/* [relative] */ - struct dom_sid *group_sid;/* [relative] */ - struct security_acl *sacl;/* [relative] */ - struct security_acl *dacl;/* [relative] */ -}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */; - -struct sec_desc_buf { - uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */ - struct security_descriptor *sd;/* [unique,subcontext(4)] */ -}/* [public] */; - -struct security_token { - struct dom_sid *user_sid;/* [unique] */ - struct dom_sid *group_sid;/* [unique] */ - uint32_t num_sids; - struct dom_sid **sids;/* [unique,size_is(num_sids)] */ - uint64_t privilege_mask; -}/* [public] */; - -/* bitmap security_secinfo */ -#define SECINFO_OWNER ( 0x00000001 ) -#define SECINFO_GROUP ( 0x00000002 ) -#define SECINFO_DACL ( 0x00000004 ) -#define SECINFO_SACL ( 0x00000008 ) -#define SECINFO_UNPROTECTED_SACL ( 0x10000000 ) -#define SECINFO_UNPROTECTED_DACL ( 0x20000000 ) -#define SECINFO_PROTECTED_SACL ( 0x40000000 ) -#define SECINFO_PROTECTED_DACL ( 0x80000000 ) - -#endif /* _HEADER_security */ diff --git a/source3/librpc/ndr/sid.c b/source3/librpc/ndr/sid.c index 89ab2b8ea5..b6ec045806 100644 --- a/source3/librpc/ndr/sid.c +++ b/source3/librpc/ndr/sid.c @@ -187,70 +187,3 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const return NDR_ERR_SUCCESS; } - -enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd,ndr->flags))); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->sd) { - { - struct ndr_push *_ndr_sd; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1)); - NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1)); - } - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r) -{ - uint32_t _ptr_sd; - TALLOC_CTX *_mem_save_sd_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size)); - if (r->sd_size > 0x40000) { /* sd_size is unsigned */ - return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd)); - if (_ptr_sd) { - NDR_PULL_ALLOC(ndr, r->sd); - } else { - r->sd = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->sd) { - _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0); - { - struct ndr_pull *_ndr_sd; - NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1)); - NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd)); - NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1)); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0); - } - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r) -{ - ndr_print_struct(ndr, name, "sec_desc_buf"); - ndr->depth++; - ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd,ndr->flags):r->sd_size); - ndr_print_ptr(ndr, "sd", r->sd); - ndr->depth++; - if (r->sd) { - ndr_print_security_descriptor(ndr, "sd", r->sd); - } - ndr->depth--; - ndr->depth--; -} diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index 174db312c8..a3043a2152 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -73,6 +73,7 @@ werror_code_struct dos_errs[] = { "WERR_DFS_NO_SUCH_SERVER", WERR_DFS_NO_SUCH_SERVER }, { "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR }, { "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT }, + { "WERR_INVALID_COMPUTER_NAME", WERR_INVALID_COMPUTER_NAME }, { "WERR_MACHINE_LOCKED", WERR_MACHINE_LOCKED }, { "WERR_DC_NOT_FOUND", WERR_DC_NOT_FOUND }, { "WERR_SETUP_NOT_JOINED", WERR_SETUP_NOT_JOINED }, diff --git a/source3/libsmb/ntlmssp_parse.c b/source3/libsmb/ntlmssp_parse.c index ac8846ad1e..70377cba7d 100644 --- a/source3/libsmb/ntlmssp_parse.c +++ b/source3/libsmb/ntlmssp_parse.c @@ -170,6 +170,7 @@ bool msrpc_gen(DATA_BLOB *blob, /* a helpful macro to avoid running over the end of our blob */ #define NEED_DATA(amount) \ if ((head_ofs + amount) > blob->length) { \ + va_end(ap); \ return False; \ } @@ -216,16 +217,20 @@ bool msrpc_parse(const DATA_BLOB *blob, if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { + va_end(ap); return false; } if (len1 & 1) { /* if odd length and unicode */ + va_end(ap); return false; } if (blob->data + ptr < (uint8 *)(unsigned long)ptr || - blob->data + ptr < blob->data) + blob->data + ptr < blob->data) { + va_end(ap); return false; + } if (0 < len1) { char *p = NULL; @@ -261,13 +266,16 @@ bool msrpc_parse(const DATA_BLOB *blob, if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { + va_end(ap); return false; } if (blob->data + ptr < (uint8 *)(unsigned long)ptr || - blob->data + ptr < blob->data) + blob->data + ptr < blob->data) { + va_end(ap); return false; + } if (0 < len1) { char *p = NULL; @@ -304,13 +312,16 @@ bool msrpc_parse(const DATA_BLOB *blob, if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { + va_end(ap); return false; } if (blob->data + ptr < (uint8 *)(unsigned long)ptr || - blob->data + ptr < blob->data) + blob->data + ptr < blob->data) { + va_end(ap); return false; + } *b = data_blob(blob->data + ptr, len1); } @@ -322,6 +333,7 @@ bool msrpc_parse(const DATA_BLOB *blob, NEED_DATA(len1); if (blob->data + head_ofs < (uint8 *)head_ofs || blob->data + head_ofs < blob->data) { + va_end(ap); return false; } @@ -337,7 +349,8 @@ bool msrpc_parse(const DATA_BLOB *blob, s = va_arg(ap, char *); if (blob->data + head_ofs < (uint8 *)head_ofs || - blob->data + head_ofs < blob->data) { + blob->data + head_ofs < blob->data) { + va_end(ap); return false; } @@ -351,11 +364,13 @@ bool msrpc_parse(const DATA_BLOB *blob, blob->length - head_ofs, STR_ASCII|STR_TERMINATE); if (ret == (size_t)-1 || p == NULL) { + va_end(ap); return false; } head_ofs += ret; if (strcmp(s, p) != 0) { TALLOC_FREE(p); + va_end(ap); return false; } TALLOC_FREE(p); diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 208066bedc..171022b01b 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -579,7 +579,7 @@ static bool xattr_tdb_init(int snum, struct db_context **p_db) lock_path("xattr.tdb")); if (dbname == NULL) { - errno = ENOTSUP; + errno = ENOSYS; return false; } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 344831ddca..378b6f3dbe 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -676,11 +676,18 @@ static bool open_sockets(bool isdaemon, int port) ClientNMB = 0; } + if (ClientNMB == -1) { + return false; + } + ClientDGRAM = open_socket_in(SOCK_DGRAM, DGRAM_PORT, 3, &ss, true); - if (ClientNMB == -1) { + if (ClientDGRAM == -1) { + if (ClientNMB != 0) { + close(ClientNMB); + } return false; } diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 147df68a69..5a2f5c46b4 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -81,12 +81,14 @@ static void sync_child(char *name, int nm_type, } if (!cli_set_port(cli, 139)) { + cli_shutdown(cli); return; } in_addr_to_sockaddr_storage(&ss, ip); status = cli_connect(cli, name, &ss); if (!NT_STATUS_IS_OK(status)) { + cli_shutdown(cli); return; } diff --git a/source3/nsswitch/libwbclient/wbc_sid.c b/source3/nsswitch/libwbclient/wbc_sid.c index abe1457cc1..f5f553c4c6 100644 --- a/source3/nsswitch/libwbclient/wbc_sid.c +++ b/source3/nsswitch/libwbclient/wbc_sid.c @@ -355,6 +355,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, &request, &response); talloc_free(ridlist); + BAIL_ON_WBC_ERROR(wbc_status); domain_name = talloc_strdup(NULL, response.data.domain_name); BAIL_ON_PTR_ERROR(domain_name, wbc_status); diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 55dd654131..9f66eb934e 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -464,6 +464,9 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, { int i; + DEBUG(10, ("lookup_rids called for domain sid '%s'\n", + sid_string_dbg(domain_sid))); + if (num_rids) { *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids); *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); @@ -596,6 +599,16 @@ static bool lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx, return true; } + if (sid_check_is_unix_users(sid)) { + *name = talloc_strdup(mem_ctx, unix_users_domain_name()); + return true; + } + + if (sid_check_is_unix_groups(sid)) { + *name = talloc_strdup(mem_ctx, unix_groups_domain_name()); + return true; + } + if (sid->num_auths != 4) { /* This can't be a domain */ return false; @@ -922,6 +935,8 @@ bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, TALLOC_CTX *tmp_ctx; bool ret = false; + DEBUG(10, ("lookup_sid called for SID '%s'\n", sid_string_dbg(sid))); + if (!(tmp_ctx = talloc_new(mem_ctx))) { DEBUG(0, ("talloc_new failed\n")); return false; diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index cc4b744a11..2a324fdd5c 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -41,15 +41,18 @@ static int print_run_command(int snum, const char* printername, bool do_sub, /* check for a valid system printername and valid command to run */ if ( !printername || !*printername ) { + va_end(ap); return -1; } if (!command || !*command) { + va_end(ap); return -1; } syscmd = talloc_strdup(ctx, command); if (!syscmd) { + va_end(ap); return -1; } @@ -57,6 +60,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub, char *value = va_arg(ap,char *); syscmd = talloc_string_sub(ctx, syscmd, arg, value); if (!syscmd) { + va_end(ap); return -1; } } diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index 92077aa847..3740ff0ee4 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1234,7 +1234,7 @@ static void regfio_mem_free( REGF_FILE *file ) /* cleanup for a file opened for write */ - if ( file->open_flags & (O_WRONLY|O_RDWR) ) { + if ((file->fd != -1) && (file->open_flags & (O_WRONLY|O_RDWR))) { prs_struct ps; REGF_SK_REC *sk; diff --git a/source3/rpc_client/cli_ds.c b/source3/rpc_client/cli_ds.c index 71516b89f2..c9724dec7b 100644 --- a/source3/rpc_client/cli_ds.c +++ b/source3/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/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index e192e4ca26..54c6c7f23e 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -593,109 +593,6 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, return WERR_OK; } -/* Dsr_GetDCNameEx */ - -WERROR rpccli_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *server_name, - const char *domain_name, - struct GUID *domain_guid, - const char *site_name, - uint32_t flags, - struct DS_DOMAIN_CONTROLLER_INFO **info_out) -{ - prs_struct qbuf, rbuf; - NET_Q_DSR_GETDCNAMEEX q; - NET_R_DSR_GETDCNAME r; - char *tmp_str; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialize input parameters */ - - tmp_str = talloc_asprintf(mem_ctx, "\\\\%s", server_name); - if (tmp_str == NULL) { - return WERR_NOMEM; - } - - init_net_q_dsr_getdcnameex(&q, server_name, domain_name, domain_guid, - site_name, flags); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX, - q, r, - qbuf, rbuf, - net_io_q_dsr_getdcnameex, - net_io_r_dsr_getdcname, - WERR_GENERAL_FAILURE); - - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - r.result = pull_domain_controller_info_from_getdcname_reply(mem_ctx, info_out, &r); - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - return WERR_OK; -} - -/* Dsr_GetDCNameEx */ - -WERROR rpccli_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *server_name, - const char *client_account, - uint32 mask, - const char *domain_name, - struct GUID *domain_guid, - const char *site_name, - uint32_t flags, - struct DS_DOMAIN_CONTROLLER_INFO **info_out) -{ - prs_struct qbuf, rbuf; - NET_Q_DSR_GETDCNAMEEX2 q; - NET_R_DSR_GETDCNAME r; - char *tmp_str; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialize input parameters */ - - tmp_str = talloc_asprintf(mem_ctx, "\\\\%s", server_name); - if (tmp_str == NULL) { - return WERR_NOMEM; - } - - init_net_q_dsr_getdcnameex2(&q, server_name, domain_name, client_account, - mask, domain_guid, site_name, flags); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX2, - q, r, - qbuf, rbuf, - net_io_q_dsr_getdcnameex2, - net_io_r_dsr_getdcname, - WERR_GENERAL_FAILURE); - - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - r.result = pull_domain_controller_info_from_getdcname_reply(mem_ctx, info_out, &r); - if (!W_ERROR_IS_OK(r.result)) { - return r.result; - } - - return WERR_OK; -} - - /* Dsr_GetSiteName */ WERROR rpccli_netlogon_dsr_getsitename(struct rpc_pipe_client *cli, diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 81b2ea5d68..40d0ac5da9 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/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/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 7cf8726052..a752717e8c 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -1981,91 +1981,6 @@ NTSTATUS rpccli_samr_set_sec_obj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return result; } - -/* Get domain password info */ - -NTSTATUS rpccli_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint16 *min_pwd_length, uint32 *password_properties) -{ - prs_struct qbuf, rbuf; - SAMR_Q_GET_DOM_PWINFO q; - SAMR_R_GET_DOM_PWINFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_get_dom_pwinfo\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_get_dom_pwinfo(&q, cli->cli->desthost); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_DOM_PWINFO, - q, r, - qbuf, rbuf, - samr_io_q_get_dom_pwinfo, - samr_io_r_get_dom_pwinfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - if (min_pwd_length) - *min_pwd_length = r.min_pwd_length; - if (password_properties) - *password_properties = r.password_properties; - } - - return result; -} - -/* Get domain password info */ - -NTSTATUS rpccli_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint16 *min_pwd_length, - uint32 *password_properties, uint32 *unknown1) -{ - prs_struct qbuf, rbuf; - SAMR_Q_GET_USRDOM_PWINFO q; - SAMR_R_GET_USRDOM_PWINFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_get_usrdom_pwinfo\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_get_usrdom_pwinfo(&q, pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_USRDOM_PWINFO, - q, r, - qbuf, rbuf, - samr_io_q_get_usrdom_pwinfo, - samr_io_r_get_usrdom_pwinfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - if (min_pwd_length) - *min_pwd_length = r.min_pwd_length; - if (password_properties) - *password_properties = r.password_properties; - if (unknown1) - *unknown1 = r.unknown_1; - } - - return result; -} - - /* Lookup Domain Name */ NTSTATUS rpccli_samr_lookup_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 8f3ce361e7..3cf4156278 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/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/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 98c4283347..1bddfba28e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2082,53 +2082,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru } /******************************************************************* - Reads or writes an LSA_Q_OPEN_SECRET structure. -********************************************************************/ - -bool lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->handle, ps, depth)) - return False; - - if(!prs_unistr4 ("secretname", ps, depth, &in->secretname)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("access", ps, depth, &in->access)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_OPEN_SECRET structure. -********************************************************************/ - -bool lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &out->handle, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* Inits an LSA_Q_ENUM_PRIVS structure. ********************************************************************/ @@ -3315,239 +3268,6 @@ bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out } /******************************************************************* - Inits an LSA_Q_OPEN_TRUSTED_DOMAIN structure. -********************************************************************/ - -void init_lsa_q_open_trusted_domain(LSA_Q_OPEN_TRUSTED_DOMAIN *q, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access) -{ - memcpy(&q->pol, hnd, sizeof(q->pol)); - - init_dom_sid2(&q->sid, sid); - q->access_mask = desired_access; -} - -/******************************************************************* -********************************************************************/ - -#if 0 /* jerry, I think this not correct - gd */ -bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("", &in->handle, ps, depth)) - return False; - - if(!prs_uint32("count", ps, depth, &in->count)) - return False; - - if(!smb_io_dom_sid("sid", &in->sid, ps, depth)) - return False; - - return True; -} -#endif - - -/******************************************************************* -********************************************************************/ - -bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth)) - return False; - - if(!smb_io_dom_sid2("sid", &q_o->sid, ps, depth)) - return False; - - if(!prs_uint32("access", ps, depth, &q_o->access_mask)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN structure. -********************************************************************/ - -bool lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("handle", &out->handle, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAIN *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_create_trusted_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->handle, ps, depth)) - return False; - - if(!prs_unistr4 ("secretname", ps, depth, &in->secretname)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("access", ps, depth, &in->access)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAIN *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_create_trusted_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("", &out->handle, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_create_secret"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->handle, ps, depth)) - return False; - - if(!prs_unistr4 ("secretname", ps, depth, &in->secretname)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("access", ps, depth, &in->access)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_create_secret"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("", &out->handle, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - - - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_DATA_BLOB *blob ) -{ - prs_debug(ps, depth, desc, "lsa_io_data_blob"); - depth++; - - if ( !prs_uint32("size", ps, depth, &blob->size) ) - return False; - if ( !prs_uint32("size", ps, depth, &blob->size) ) - return False; - - if ( !prs_io_unistr2_p(desc, ps, depth, &blob->data) ) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_set_secret"); - depth++; - - if ( !prs_align(ps) ) - return False; - - if ( !smb_io_pol_hnd("", &in->handle, ps, depth) ) - return False; - - if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob )) - return False; - - if( !prs_align(ps) ) - return False; - if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob )) - return False; - - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_set_secret"); - depth++; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* ********************************************************************/ bool lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth) @@ -3577,129 +3297,3 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru return True; } - -/******************************************************************* - Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure. -********************************************************************/ - -void init_q_query_dom_info(LSA_Q_QUERY_DOM_INFO_POLICY *in, POLICY_HND *hnd, uint16 info_class) -{ - DEBUG(5, ("init_q_query_dom_info\n")); - - memcpy(&in->pol, hnd, sizeof(in->pol)); - - in->info_class = info_class; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_DOM_INFO_POLICY structure. -********************************************************************/ - -bool lsa_io_q_query_dom_info(const char *desc, LSA_Q_QUERY_DOM_INFO_POLICY *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_dom_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &in->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &in->info_class)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_QUERY_DOM_INFO_POLICY structure. -********************************************************************/ - -static bool lsa_io_dominfo_query_3(const char *desc, LSA_DOM_INFO_POLICY_KERBEROS *krb_policy, - prs_struct *ps, int depth) -{ - if (!prs_align_uint64(ps)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("enforce_restrictions", ps, depth, &krb_policy->enforce_restrictions)) - return False; - - if (!prs_align_uint64(ps)) - return False; - - if (!smb_io_nttime("service_tkt_lifetime", ps, depth, &krb_policy->service_tkt_lifetime)) - return False; - - if (!prs_align_uint64(ps)) - return False; - - if (!smb_io_nttime("user_tkt_lifetime", ps, depth, &krb_policy->user_tkt_lifetime)) - return False; - - if (!prs_align_uint64(ps)) - return False; - - if (!smb_io_nttime("user_tkt_renewaltime", ps, depth, &krb_policy->user_tkt_renewaltime)) - return False; - - if (!prs_align_uint64(ps)) - return False; - - if (!smb_io_nttime("clock_skew", ps, depth, &krb_policy->clock_skew)) - return False; - - if (!prs_align_uint64(ps)) - return False; - - if (!smb_io_nttime("unknown6", ps, depth, &krb_policy->unknown6)) - return False; - - return True; -} - -static bool lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, LSA_DOM_INFO_UNION *info) -{ - prs_debug(ps, depth, desc, "lsa_io_dom_info_query"); - depth++; - - if(!prs_align_uint16(ps)) - return False; - - if(!prs_uint16("info_class", ps, depth, &info->info_class)) - return False; - - switch (info->info_class) { - case 3: - if (!lsa_io_dominfo_query_3("krb_policy", &info->krb_policy, ps, depth)) - return False; - break; - default: - DEBUG(0,("unsupported info-level: %d\n", info->info_class)); - return False; - break; - } - - return True; -} - - -bool lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info"); - depth++; - - if (!prs_pointer("dominfo", ps, depth, (void*)&out->info, - sizeof(LSA_DOM_INFO_UNION), - (PRS_POINTER_CAST)lsa_io_dom_info_query) ) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b8c6479fb8..d6a99b8731 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3440,67 +3440,6 @@ void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, } /******************************************************************* - Inits a NET_Q_DSR_GETDCNAMEEX structure. -********************************************************************/ - -void init_net_q_dsr_getdcnameex(NET_Q_DSR_GETDCNAMEEX *r_t, const char *server_unc, - const char *domain_name, - struct GUID *domain_guid, - const char *site_name, - uint32_t flags) -{ - DEBUG(5, ("init_net_q_dsr_getdcnameex\n")); - - r_t->ptr_server_unc = (server_unc != NULL); - init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE); - - r_t->ptr_domain_name = (domain_name != NULL); - init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE); - - r_t->ptr_domain_guid = (domain_guid != NULL); - r_t->domain_guid = domain_guid; - - r_t->ptr_site_name = (site_name != NULL); - init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE); - - r_t->flags = flags; -} - -/******************************************************************* - Inits a NET_Q_DSR_GETDCNAMEEX2 structure. -********************************************************************/ - -void init_net_q_dsr_getdcnameex2(NET_Q_DSR_GETDCNAMEEX2 *r_t, const char *server_unc, - const char *domain_name, - const char *client_account, - uint32 mask, - struct GUID *domain_guid, - const char *site_name, - uint32_t flags) -{ - DEBUG(5, ("init_net_q_dsr_getdcnameex2\n")); - - r_t->ptr_server_unc = (server_unc != NULL); - init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE); - - r_t->ptr_client_account = (client_account != NULL); - init_unistr2(&r_t->uni_client_account, client_account, UNI_STR_TERMINATE); - - r_t->mask = mask; - - r_t->ptr_domain_name = (domain_name != NULL); - init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE); - - r_t->ptr_domain_guid = (domain_guid != NULL); - r_t->domain_guid = domain_guid; - - r_t->ptr_site_name = (site_name != NULL); - init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE); - - r_t->flags = flags; -} - -/******************************************************************* Reads or writes an NET_Q_DSR_GETDCNAME structure. ********************************************************************/ @@ -3572,154 +3511,6 @@ bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, } /******************************************************************* - Reads or writes an NET_Q_DSR_GETDCNAMEEX structure. -********************************************************************/ - -bool net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t, - prs_struct *ps, int depth) -{ - if (r_t == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex"); - depth++; - - if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc)) - return False; - - if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc, - r_t->ptr_server_unc, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name)) - return False; - - if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name, - r_t->ptr_domain_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid)) - return False; - - if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) { - r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); - if (r_t->domain_guid == NULL) - return False; - } - - if ((r_t->ptr_domain_guid) && - (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth))) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name)) - return False; - - if (!smb_io_unistr2("site_name", &r_t->uni_site_name, - r_t->ptr_site_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("flags", ps, depth, &r_t->flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an NET_Q_DSR_GETDCNAMEEX2 structure. -********************************************************************/ - -bool net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t, - prs_struct *ps, int depth) -{ - if (r_t == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex2"); - depth++; - - if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc)) - return False; - - if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc, - r_t->ptr_server_unc, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_client_account", ps, depth, &r_t->ptr_client_account)) - return False; - - if (!smb_io_unistr2("client_account", &r_t->uni_client_account, - r_t->ptr_client_account, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("mask", ps, depth, &r_t->mask)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name)) - return False; - - if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name, - r_t->ptr_domain_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid)) - return False; - - if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) { - r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); - if (r_t->domain_guid == NULL) - return False; - } - - if ((r_t->ptr_domain_guid) && - (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth))) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name)) - return False; - - if (!smb_io_unistr2("site_name", &r_t->uni_site_name, - r_t->ptr_site_name, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("flags", ps, depth, &r_t->flags)) - return False; - - return True; -} - - - -/******************************************************************* Inits a NET_R_DSR_GETDCNAME structure. ********************************************************************/ void init_net_r_dsr_getdcname(NET_R_DSR_GETDCNAME *r_t, const char *dc_unc, diff --git a/source3/rpc_server/srv_dssetup_nt.c b/source3/rpc_server/srv_dssetup_nt.c new file mode 100644 index 0000000000..ea535a3375 --- /dev/null +++ b/source3/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)); + werr = WERR_UNKNOWN_LEVEL; + } + + return werr; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, + struct dssetup_DsRoleDnsNameToFlatName *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, + struct dssetup_DsRoleDcAsDc *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, + struct dssetup_DsRoleDcAsReplica *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, + struct dssetup_DsRoleDemoteDc *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, + struct dssetup_DsRoleGetDcOperationProgress *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, + struct dssetup_DsRoleGetDcOperationResults *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleCancel(pipes_struct *p, + struct dssetup_DsRoleCancel *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, + struct dssetup_DsRoleServerSaveStateForUpgrade *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, + struct dssetup_DsRoleUpgradeDownlevelServer *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, + struct dssetup_DsRoleAbortDownlevelServerUpgrade *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + diff --git a/source3/rpc_server/srv_lsa_ds.c b/source3/rpc_server/srv_lsa_ds.c deleted file mode 100644 index 55baa40261..0000000000 --- a/source3/rpc_server/srv_lsa_ds.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Gerald Carter 2003 - * - * 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/>. - */ - -/* This is the interface for the registry functions. */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_SRV - -/******************************************************************* - ********************************************************************/ - -static bool api_dsrole_get_primary_dominfo(pipes_struct *p) -{ - DS_Q_GETPRIMDOMINFO q_u; - DS_R_GETPRIMDOMINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* grab the request */ - if ( !ds_io_q_getprimdominfo("", &q_u, data, 0) ) - return False; - - /* construct reply. */ - r_u.status = _dsrole_get_primary_dominfo( p, &q_u, &r_u ); - - if ( !ds_io_r_getprimdominfo("", &r_u, rdata, 0) ) - return False; - - return True; -} - -/******************************************************************* - stub functions for unimplemented RPC -*******************************************************************/ - -static bool api_dsrole_stub( pipes_struct *p ) -{ - DEBUG(0,("api_dsrole_stub: Hmmm....didn't know this RPC existed...\n")); - - return False; -} - - -/******************************************************************* - array of \PIPE\lsass (new windows 2000 UUID) operations -********************************************************************/ -static struct api_struct api_lsa_ds_cmds[] = { - { "DS_NOP", DS_NOP, api_dsrole_stub }, - { "DS_GETPRIMDOMINFO", DS_GETPRIMDOMINFO, api_dsrole_get_primary_dominfo } - -}; - -void lsa_ds_get_pipe_fns( struct api_struct **fns, int *n_fns ) -{ - *fns = api_lsa_ds_cmds; - *n_fns = sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct); -} - - -NTSTATUS rpc_lsa_ds_init(void) -{ - return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsa_ds", "lsa_ds", api_lsa_ds_cmds, - sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct)); -} diff --git a/source3/rpc_server/srv_lsa_ds_nt.c b/source3/rpc_server/srv_lsa_ds_nt.c deleted file mode 100644 index 994b3cccca..0000000000 --- a/source3/rpc_server/srv_lsa_ds_nt.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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. - * - * 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/>. - */ - -/* Implementation of registry functions. */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_SRV - -/******************************************************************** - Fill in a DS_DOMINFO_CTR structure - ********************************************************************/ - -static NTSTATUS fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **info) -{ - DSROLE_PRIMARY_DOMAIN_INFO_BASIC *basic; - const char *netbios_domain = ""; - fstring dnsdomain; - - DEBUG(10,("fill_dsrole_dominfo_basic: enter\n")); - - if ( !(basic = TALLOC_ZERO_P(ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC)) ) { - DEBUG(0,("fill_dsrole_dominfo_basic: FATAL error! talloc_xero() failed\n")); - return NT_STATUS_NO_MEMORY; - } - - switch ( lp_server_role() ) { - case ROLE_STANDALONE: - basic->machine_role = DSROLE_STANDALONE_SRV; - basic->netbios_ptr = 1; - netbios_domain = get_global_sam_name(); - break; - case ROLE_DOMAIN_MEMBER: - basic->netbios_ptr = 1; - netbios_domain = lp_workgroup(); - basic->machine_role = DSROLE_DOMAIN_MEMBER_SRV; - break; - case ROLE_DOMAIN_BDC: - basic->netbios_ptr = 1; - netbios_domain = get_global_sam_name(); - basic->machine_role = DSROLE_BDC; - break; - case ROLE_DOMAIN_PDC: - basic->netbios_ptr = 1; - netbios_domain = get_global_sam_name(); - basic->machine_role = DSROLE_PDC; - break; - } - - /* always set netbios name */ - - init_unistr2( &basic->netbios_domain, netbios_domain, UNI_STR_TERMINATE); - - if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) ) - basic->flags |= DSROLE_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->dnsname_ptr = 1; - init_unistr2( &basic->dns_domain, dnsdomain, UNI_STR_TERMINATE); - - /* FIXME!! We really should fill in the correct forest - name. Should get this information from winbindd. */ - basic->forestname_ptr = 1; - init_unistr2( &basic->forest_domain, dnsdomain, UNI_STR_TERMINATE); - } else { - /* security = domain should not fill in the dns or - forest name */ - basic->dnsname_ptr = 0; - basic->forestname_ptr = 0; - } - - *info = basic; - - return NT_STATUS_OK; -} - -/******************************************************************** - Implement the DsroleGetPrimaryDomainInfo() call - ********************************************************************/ - -NTSTATUS _dsrole_get_primary_dominfo(pipes_struct *p, DS_Q_GETPRIMDOMINFO *q_u, DS_R_GETPRIMDOMINFO *r_u) -{ - NTSTATUS result = NT_STATUS_OK; - uint32 level = q_u->level; - - switch ( level ) { - - case DsRolePrimaryDomainInfoBasic: - r_u->level = DsRolePrimaryDomainInfoBasic; - r_u->ptr = 1; - result = fill_dsrole_dominfo_basic( p->mem_ctx, &r_u->info.basic ); - break; - - default: - DEBUG(0,("_dsrole_get_primary_dominfo: Unsupported info level [%d]!\n", - level)); - result = NT_STATUS_INVALID_LEVEL; - } - - return result; -} - - - diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 5ede0c93f4..06694a2701 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -2363,8 +2363,8 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns ) case PI_LSARPC: lsa_get_pipe_fns( &cmds, &n_cmds ); break; - case PI_LSARPC_DS: - lsa_ds_get_pipe_fns( &cmds, &n_cmds ); + case PI_DSSETUP: + dssetup_get_pipe_fns( &cmds, &n_cmds ); break; case PI_SAMR: samr_get_pipe_fns( &cmds, &n_cmds ); diff --git a/source3/rpcclient/cmd_ds.c b/source3/rpcclient/cmd_ds.c index 1f36dc3b45..477ff863dd 100644 --- a/source3/rpcclient/cmd_ds.c +++ b/source3/rpcclient/cmd_ds.c @@ -3,6 +3,7 @@ RPC pipe client 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 @@ -23,27 +24,37 @@ /* Look up domain related information on a remote host */ -static NTSTATUS cmd_ds_dsrole_getprimarydominfo(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, int argc, - const char **argv) +static WERROR cmd_ds_dsrole_getprimarydominfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) { - NTSTATUS result; - DS_DOMINFO_CTR ctr; - - result = rpccli_ds_getprimarydominfo( cli, mem_ctx, DsRolePrimaryDomainInfoBasic, &ctr ); - if ( NT_STATUS_IS_OK(result) ) - { - printf ("Machine Role = [%d]\n", ctr.basic->machine_role); - - if ( ctr.basic->flags & DSROLE_PRIMARY_DS_RUNNING ) { - printf( "Directory Service is running.\n"); - printf( "Domain is in %s mode.\n", (ctr.basic->flags & DSROLE_PRIMARY_DS_MIXED_MODE) ? "mixed" : "native" ); - } - else - printf( "Directory Service not running on server\n"); + NTSTATUS status; + WERROR werr; + union dssetup_DsRoleInfo info; + + status = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(cli, mem_ctx, + DS_ROLE_BASIC_INFORMATION, + &info, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); } - - return result; + + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + printf ("Machine Role = [%d]\n", info.basic.role); + + if (info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING) { + printf("Directory Service is running.\n"); + printf("Domain is in %s mode.\n", + (info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE) ? "mixed" : "native" ); + } else { + printf("Directory Service not running on server\n"); + } + + return werr; } static NTSTATUS cmd_ds_enum_domain_trusts(struct rpc_pipe_client *cli, @@ -77,7 +88,7 @@ struct cmd_set ds_commands[] = { { "LSARPC-DS" }, - { "dsroledominfo", RPC_RTYPE_NTSTATUS, cmd_ds_dsrole_getprimarydominfo, NULL, PI_LSARPC_DS, NULL, "Get Primary Domain Information", "" }, + { "dsroledominfo", RPC_RTYPE_WERROR, NULL, cmd_ds_dsrole_getprimarydominfo, PI_DSSETUP, NULL, "Get Primary Domain Information", "" }, { "dsenumdomtrusts", RPC_RTYPE_NTSTATUS, cmd_ds_enum_domain_trusts, NULL, PI_NETLOGON, NULL, "Enumerate all trusted domains in an AD forest", "" }, { NULL } diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 2c1f7e0f11..731c3de268 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -165,12 +165,13 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, const char **argv) { WERROR result; - uint32 flags = DS_RETURN_DNS_NAME; + NTSTATUS status; + uint32_t flags = DS_RETURN_DNS_NAME; const char *server_name = cli->cli->desthost; const char *domain_name; const char *site_name = NULL; struct GUID domain_guid = GUID_zero(); - struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + struct netr_DsRGetDCNameInfo *info = NULL; if (argc < 2) { fprintf(stderr, "Usage: %s [domain_name] [domain_guid] " @@ -178,8 +179,7 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, return WERR_OK; } - if (argc >= 2) - domain_name = argv[1]; + domain_name = argv[1]; if (argc >= 3) { if (!NT_STATUS_IS_OK(GUID_from_string(argv[2], &domain_guid))) { @@ -187,26 +187,34 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, } } - if (argc >= 4) + if (argc >= 4) { site_name = argv[3]; + } - if (argc >= 5) + if (argc >= 5) { sscanf(argv[4], "%x", &flags); + } debug_dsdcinfo_flags(1,flags); - result = rpccli_netlogon_dsr_getdcnameex(cli, mem_ctx, server_name, domain_name, - &domain_guid, site_name, flags, - &info); + status = rpccli_netr_DsRGetDCNameEx(cli, mem_ctx, + server_name, + domain_name, + &domain_guid, + site_name, + flags, + &info, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } - if (W_ERROR_IS_OK(result)) { - d_printf("DsGetDcNameEx gave\n"); - display_ds_domain_controller_info(mem_ctx, info); - return WERR_OK; + if (!W_ERROR_IS_OK(result)) { + return result; } - printf("rpccli_netlogon_dsr_getdcnameex returned %s\n", - dos_errstr(result)); + d_printf("DsRGetDCNameEx gave %s\n", + NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info)); return result; } @@ -216,14 +224,15 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli, const char **argv) { WERROR result; - uint32 flags = DS_RETURN_DNS_NAME; + NTSTATUS status; + uint32_t flags = DS_RETURN_DNS_NAME; const char *server_name = cli->cli->desthost; const char *domain_name = NULL; const char *client_account = NULL; - uint32 mask = 0; + uint32_t mask = 0; const char *site_name = NULL; struct GUID domain_guid = GUID_zero(); - struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + struct netr_DsRGetDCNameInfo *info = NULL; if (argc < 2) { fprintf(stderr, "Usage: %s [client_account] [acb_mask] " @@ -232,14 +241,17 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli, return WERR_OK; } - if (argc >= 2) + if (argc >= 2) { client_account = argv[1]; + } - if (argc >= 3) + if (argc >= 3) { mask = atoi(argv[2]); + } - if (argc >= 4) + if (argc >= 4) { domain_name = argv[3]; + } if (argc >= 5) { if (!NT_STATUS_IS_OK(GUID_from_string(argv[4], &domain_guid))) { @@ -247,28 +259,36 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli, } } - if (argc >= 6) + if (argc >= 6) { site_name = argv[5]; + } - if (argc >= 7) + if (argc >= 7) { sscanf(argv[6], "%x", &flags); + } debug_dsdcinfo_flags(1,flags); - result = rpccli_netlogon_dsr_getdcnameex2(cli, mem_ctx, server_name, - client_account, mask, - domain_name, &domain_guid, - site_name, flags, - &info); + status = rpccli_netr_DsRGetDCNameEx2(cli, mem_ctx, + server_name, + client_account, + mask, + domain_name, + &domain_guid, + site_name, + flags, + &info, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } - if (W_ERROR_IS_OK(result)) { - d_printf("DsGetDcNameEx2 gave\n"); - display_ds_domain_controller_info(mem_ctx, info); - return WERR_OK; + if (!W_ERROR_IS_OK(result)) { + return result; } - printf("rpccli_netlogon_dsr_getdcnameex2 returned %s\n", - dos_errstr(result)); + d_printf("DsRGetDCNameEx2 gave %s\n", + NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info)); return result; } @@ -539,6 +559,186 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli, return result; } +static WERROR cmd_netlogon_gettrustrid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr = WERR_GENERAL_FAILURE; + const char *server_name = cli->cli->desthost; + const char *domain_name = lp_workgroup(); + uint32_t rid = 0; + + if (argc < 1 || argc > 3) { + fprintf(stderr, "Usage: %s <server_name> <domain_name>\n", + argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + domain_name = argv[2]; + } + + status = rpccli_netr_LogonGetTrustRid(cli, mem_ctx, + server_name, + domain_name, + &rid, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + printf("Rid: %d\n", rid); + } + done: + return werr; +} + +static WERROR cmd_netlogon_dsr_enumtrustdom(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr = WERR_GENERAL_FAILURE; + const char *server_name = cli->cli->desthost; + uint32_t trust_flags = NETR_TRUST_FLAG_IN_FOREST; + struct netr_DomainTrustList trusts; + + if (argc < 1 || argc > 3) { + fprintf(stderr, "Usage: %s <server_name> <trust_flags>\n", + argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + sscanf(argv[2], "%x", &trust_flags); + } + + status = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx, + server_name, + trust_flags, + &trusts, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + int i; + + printf("%d domains returned\n", trusts.count); + + for (i=0; i<trusts.count; i++ ) { + printf("%s (%s)\n", + trusts.array[i].dns_name, + trusts.array[i].netbios_name); + } + } + done: + return werr; +} + +static WERROR cmd_netlogon_deregisterdnsrecords(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr = WERR_GENERAL_FAILURE; + const char *server_name = cli->cli->desthost; + const char *domain = lp_workgroup(); + const char *dns_host = NULL; + + if (argc < 1 || argc > 4) { + fprintf(stderr, "Usage: %s <server_name> <domain_name> " + "<dns_host>\n", argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + domain = argv[2]; + } + + if (argc >= 4) { + dns_host = argv[3]; + } + + status = rpccli_netr_DsrDeregisterDNSHostRecords(cli, mem_ctx, + server_name, + domain, + NULL, + NULL, + dns_host, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + printf("success\n"); + } + done: + return werr; +} + +static WERROR cmd_netlogon_dsr_getforesttrustinfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr = WERR_GENERAL_FAILURE; + const char *server_name = cli->cli->desthost; + const char *trusted_domain_name = NULL; + struct lsa_ForestTrustInformation *info = NULL; + uint32_t flags = 0; + + if (argc < 1 || argc > 4) { + fprintf(stderr, "Usage: %s <server_name> <trusted_domain_name> " + "<flags>\n", argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + trusted_domain_name = argv[2]; + } + + if (argc >= 4) { + sscanf(argv[3], "%x", &flags); + } + + status = rpccli_netr_DsRGetForestTrustInformation(cli, mem_ctx, + server_name, + trusted_domain_name, + flags, + &info, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + printf("success\n"); + } + done: + return werr; +} + /* List of commands exported by this module */ @@ -553,11 +753,15 @@ struct cmd_set netlogon_commands[] = { { "dsr_getdcnameex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex, PI_NETLOGON, NULL, "Get trusted DC name", "" }, { "dsr_getdcnameex2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex2, PI_NETLOGON, NULL, "Get trusted DC name", "" }, { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, PI_NETLOGON, NULL, "Get sitename", "" }, + { "dsr_getforesttrustinfo", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getforesttrustinfo, PI_NETLOGON, NULL, "Get Forest Trust Info", "" }, { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, NULL, "Logon Control", "" }, { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, PI_NETLOGON, NULL, "Sam Synchronisation", "" }, { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, NULL, "Query Sam Deltas", "" }, { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, PI_NETLOGON, NULL, "Sam Logon", "" }, { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, PI_NETLOGON, NULL, "Change Trust Account Password", "" }, + { "gettrustrid", RPC_RTYPE_WERROR, NULL, cmd_netlogon_gettrustrid, PI_NETLOGON, NULL, "Get trust rid", "" }, + { "dsr_enumtrustdom", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, PI_NETLOGON, NULL, "Enumerate trusted domains", "" }, + { "deregisterdnsrecords", RPC_RTYPE_WERROR, NULL, cmd_netlogon_deregisterdnsrecords, PI_NETLOGON, NULL, "Deregister DNS records", "" }, { NULL } }; diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 5b42c6bc0e..ae22a68deb 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -122,7 +122,7 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr) } -static void display_password_properties(uint32 password_properties) +static void display_password_properties(uint32_t password_properties) { printf("password_properties: 0x%08x\n", password_properties); @@ -1483,10 +1483,11 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli, /* Create domain user */ acb_info = ACB_NORMAL; - acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | - SAMR_USER_GETATTR | SAMR_USER_SETATTR; + acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; result = rpccli_samr_create_dom_user(cli, mem_ctx, &domain_pol, acct_name, acb_info, acct_flags, @@ -2011,14 +2012,14 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; POLICY_HND connect_pol, domain_pol, user_pol; - uint16 min_pwd_length; - uint32 password_properties, unknown1, rid; + struct samr_PwInfo info; + uint32_t rid; if (argc != 2) { printf("Usage: %s rid\n", argv[0]); return NT_STATUS_OK; } - + sscanf(argv[1], "%i", &rid); result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -2043,14 +2044,10 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, goto done; } - result = rpccli_samr_get_usrdom_pwinfo(cli, mem_ctx, &user_pol, - &min_pwd_length, &password_properties, - &unknown1) ; - + result = rpccli_samr_GetUserPwInfo(cli, mem_ctx, &user_pol, &info); if (NT_STATUS_IS_OK(result)) { - printf("min_pwd_length: %d\n", min_pwd_length); - printf("unknown1: %d\n", unknown1); - display_password_properties(password_properties); + printf("min_password_length: %d\n", info.min_password_length); + display_password_properties(info.password_properties); } done: @@ -2061,25 +2058,31 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, return result; } +static void init_lsa_String(struct lsa_String *name, const char *s) +{ + name->string = s; +} -static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, +static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - int argc, const char **argv) + int argc, const char **argv) { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint16 min_pwd_length; - uint32 password_properties; + struct lsa_String domain_name; + struct samr_PwInfo info; - if (argc != 1) { - printf("Usage: %s\n", argv[0]); + if (argc < 1 || argc > 3) { + printf("Usage: %s <domain>\n", argv[0]); return NT_STATUS_OK; } - result = rpccli_samr_get_dom_pwinfo(cli, mem_ctx, &min_pwd_length, &password_properties) ; - + init_lsa_String(&domain_name, argv[1]); + + result = rpccli_samr_GetDomPwInfo(cli, mem_ctx, &domain_name, &info); + if (NT_STATUS_IS_OK(result)) { - printf("min_pwd_length: %d\n", min_pwd_length); - display_password_properties(password_properties); + printf("min_password_length: %d\n", info.min_password_length); + display_password_properties(info.password_properties); } return result; diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index d98cb99276..b5282d2e9b 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1252,7 +1252,7 @@ static bool init_drv_info_3_members ( TALLOC_CTX *mem_ctx, DRIVER_INFO_3 *info, { char *str, *str2; uint32 len, i; - char *saveptr; + char *saveptr = NULL; /* fill in the UNISTR fields */ str = get_driver_3_param (args, ":", &info->name); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 6cec39f9c0..f60329a039 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -1408,12 +1408,12 @@ static bool create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst, psa1->flags |= (psa2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT)); psa2->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT); - + } else if (psa2->flags & SEC_ACE_FLAG_INHERIT_ONLY) { psa2->flags |= (psa1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT)); psa1->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT); - + } } } @@ -1474,10 +1474,22 @@ static bool create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst, } else if (sid_to_uid( ¤t_ace->trustee, ¤t_ace->unix_ug.uid)) { current_ace->owner_type = UID_ACE; - current_ace->type = SMB_ACL_USER; + /* If it's the owning user, this is a user_obj, not + * a user. */ + if (current_ace->unix_ug.uid == pst->st_uid) { + current_ace->type = SMB_ACL_USER_OBJ; + } else { + current_ace->type = SMB_ACL_USER; + } } else if (sid_to_gid( ¤t_ace->trustee, ¤t_ace->unix_ug.gid)) { current_ace->owner_type = GID_ACE; - current_ace->type = SMB_ACL_GROUP; + /* If it's the primary group, this is a group_obj, not + * a group. */ + if (current_ace->unix_ug.gid == pst->st_gid) { + current_ace->type = SMB_ACL_GROUP_OBJ; + } else { + current_ace->type = SMB_ACL_GROUP; + } } else { /* * Silently ignore map failures in non-mappable SIDs (NT Authority, BUILTIN etc). @@ -3202,57 +3214,8 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) return ret; } -static NTSTATUS append_ugw_ace(files_struct *fsp, - SMB_STRUCT_STAT *psbuf, - mode_t unx_mode, - int ugw, - SEC_ACE *se) -{ - mode_t perms; - SEC_ACCESS acc; - enum security_ace_type nt_acl_type; - DOM_SID trustee; - - switch (ugw) { - case S_IRUSR: - perms = unix_perms_to_acl_perms(unx_mode, - S_IRUSR, - S_IWUSR, - S_IXUSR); - uid_to_sid(&trustee, psbuf->st_uid ); - break; - case S_IRGRP: - perms = unix_perms_to_acl_perms(unx_mode, - S_IRGRP, - S_IWGRP, - S_IXGRP); - gid_to_sid(&trustee, psbuf->st_gid ); - break; - case S_IROTH: - perms = unix_perms_to_acl_perms(unx_mode, - S_IROTH, - S_IWOTH, - S_IXOTH); - sid_copy(&trustee, &global_sid_World); - break; - default: - return NT_STATUS_INVALID_PARAMETER; - } - acc = map_canon_ace_perms(SNUM(fsp->conn), - &nt_acl_type, - perms, - fsp->is_directory); - - init_sec_ace(se, - &trustee, - nt_acl_type, - acc, - 0); - return NT_STATUS_OK; -} - /**************************************************************************** - If this is an + Take care of parent ACL inheritance. ****************************************************************************/ static NTSTATUS append_parent_acl(files_struct *fsp, @@ -3270,7 +3233,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp, NTSTATUS status; int info; unsigned int i, j; - mode_t unx_mode; + bool is_dacl_protected = (psd->type & SE_DESC_DACL_PROTECTED); ZERO_STRUCT(sbuf); @@ -3285,12 +3248,6 @@ static NTSTATUS append_parent_acl(files_struct *fsp, return NT_STATUS_NO_MEMORY; } - /* Create a default mode for u/g/w. */ - unx_mode = unix_mode(fsp->conn, - aARCH | (fsp->is_directory ? aDIR : 0), - fsp->fsp_name, - parent_name); - status = open_directory(fsp->conn, NULL, parent_name, @@ -3318,20 +3275,23 @@ static NTSTATUS append_parent_acl(files_struct *fsp, /* * Make room for potentially all the ACLs from - * the parent, plus the user/group/other triple. + * the parent. We used to add the ugw triple here, + * as we knew we were dealing with POSIX ACLs. + * We no longer need to do so as we can guarentee + * that a default ACL from the parent directory will + * be well formed for POSIX ACLs if it came from a + * POSIX ACL source, and if we're not writing to a + * POSIX ACL sink then we don't care if it's not well + * formed. JRA. */ - num_aces += parent_sd->dacl->num_aces + 3; + num_aces += parent_sd->dacl->num_aces; if((new_ace = TALLOC_ZERO_ARRAY(mem_ctx, SEC_ACE, num_aces)) == NULL) { return NT_STATUS_NO_MEMORY; } - DEBUG(10,("append_parent_acl: parent ACL has %u entries. New " - "ACL has %u entries\n", - parent_sd->dacl->num_aces, num_aces )); - /* Start by copying in all the given ACE entries. */ for (i = 0; i < psd->dacl->num_aces; i++) { sec_ace_copy(&new_ace[i], &psd->dacl->aces[i]); @@ -3342,49 +3302,95 @@ static NTSTATUS append_parent_acl(files_struct *fsp, * as that really only applies to newly created files. JRA. */ - /* - * Append u/g/w. - */ - - status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRUSR, &new_ace[i++]); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRGRP, &new_ace[i++]); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - status = append_ugw_ace(fsp, psbuf, unx_mode, S_IROTH, &new_ace[i++]); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - /* Finally append any inherited ACEs. */ for (j = 0; j < parent_sd->dacl->num_aces; j++) { SEC_ACE *se = &parent_sd->dacl->aces[j]; - uint32 i_flags = se->flags & (SEC_ACE_FLAG_OBJECT_INHERIT| - SEC_ACE_FLAG_CONTAINER_INHERIT| - SEC_ACE_FLAG_INHERIT_ONLY); if (fsp->is_directory) { - if (i_flags == SEC_ACE_FLAG_OBJECT_INHERIT) { - /* Should only apply to a file - ignore. */ + if (!(se->flags & SEC_ACE_FLAG_CONTAINER_INHERIT)) { + /* Doesn't apply to a directory - ignore. */ + DEBUG(10,("append_parent_acl: directory %s " + "ignoring non container " + "inherit flags %u on ACE with sid %s " + "from parent %s\n", + fsp->fsp_name, + (unsigned int)se->flags, + sid_string_dbg(&se->trustee), + parent_name)); continue; } } else { - if ((i_flags & (SEC_ACE_FLAG_OBJECT_INHERIT| - SEC_ACE_FLAG_INHERIT_ONLY)) != - SEC_ACE_FLAG_OBJECT_INHERIT) { - /* Should not apply to a file - ignore. */ + if (!(se->flags & SEC_ACE_FLAG_OBJECT_INHERIT)) { + /* Doesn't apply to a file - ignore. */ + DEBUG(10,("append_parent_acl: file %s " + "ignoring non object " + "inherit flags %u on ACE with sid %s " + "from parent %s\n", + fsp->fsp_name, + (unsigned int)se->flags, + sid_string_dbg(&se->trustee), + parent_name)); + continue; + } + } + + if (is_dacl_protected) { + /* If the DACL is protected it means we must + * not overwrite an existing ACE entry with the + * same SID. This is order N^2. Ouch :-(. JRA. */ + unsigned int k; + for (k = 0; k < psd->dacl->num_aces; k++) { + if (sid_equal(&psd->dacl->aces[k].trustee, + &se->trustee)) { + break; + } + } + if (k < psd->dacl->num_aces) { + /* SID matched. Ignore. */ + DEBUG(10,("append_parent_acl: path %s " + "ignoring ACE with protected sid %s " + "from parent %s\n", + fsp->fsp_name, + sid_string_dbg(&se->trustee), + parent_name)); continue; } } + sec_ace_copy(&new_ace[i], se); if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) { new_ace[i].flags &= ~(SEC_ACE_FLAG_VALID_INHERIT); } new_ace[i].flags |= SEC_ACE_FLAG_INHERITED_ACE; + + if (fsp->is_directory) { + /* + * Strip off any inherit only. It's applied. + */ + new_ace[i].flags &= ~(SEC_ACE_FLAG_INHERIT_ONLY); + if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) { + /* No further inheritance. */ + new_ace[i].flags &= + ~(SEC_ACE_FLAG_CONTAINER_INHERIT| + SEC_ACE_FLAG_OBJECT_INHERIT); + } + } else { + /* + * Strip off any container or inherit + * flags, they can't apply to objects. + */ + new_ace[i].flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT| + SEC_ACE_FLAG_INHERIT_ONLY| + SEC_ACE_FLAG_NO_PROPAGATE_INHERIT); + } i++; + + DEBUG(10,("append_parent_acl: path %s " + "inheriting ACE with sid %s " + "from parent %s\n", + fsp->fsp_name, + sid_string_dbg(&se->trustee), + parent_name)); } parent_sd->dacl->aces = new_ace; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index d961f98cc0..4672510d8d 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -20,7 +20,6 @@ #include "includes.h" -extern struct auth_context *negprot_global_auth_context; extern int smb_echo_count; static enum smb_read_errors smb_read_error = SMB_READ_OK; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index fb845220cd..1f7af82670 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2470,6 +2470,7 @@ static void samba_extended_info_version(struct smb_extended_info *extended_info) #ifdef SAMBA_VERSION_REVISION extended_info->samba_version |= (tolower(*SAMBA_VERSION_REVISION) - 'a' + 1) & 0xff; #endif + extended_info->samba_subversion = 0; #ifdef SAMBA_VERSION_RC_RELEASE extended_info->samba_subversion |= (SAMBA_VERSION_RC_RELEASE & 0xff) << 24; #else @@ -2480,7 +2481,7 @@ static void samba_extended_info_version(struct smb_extended_info *extended_info) #ifdef SAMBA_VERSION_VENDOR_PATCH extended_info->samba_subversion |= (SAMBA_VERSION_VENDOR_PATCH & 0xffff); #endif - /* FIXME: samba_gitcommitdate should contain the git commit date. */ + extended_info->samba_gitcommitdate = 0; #ifdef SAMBA_VERSION_GIT_COMMIT_TIME unix_to_nt_time(&extended_info->samba_gitcommitdate, SAMBA_VERSION_GIT_COMMIT_TIME); #endif diff --git a/source3/utils/net_domain.c b/source3/utils/net_domain.c index a98f090e62..1c34a3b60e 100644 --- a/source3/utils/net_domain.c +++ b/source3/utils/net_domain.c @@ -245,12 +245,14 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli, const_acct_name = acct_name; /* Don't try to set any acb_info flags other than ACB_WSTRUST */ + acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; - acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR | - SAMR_USER_SETATTR; DEBUG(10, ("Creating account with flags: %d\n",acct_flags)); + status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, acct_name, acb_info, acct_flags, &user_pol, &user_rid); diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index b08a93627d..46fbcfb8ca 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -618,10 +618,11 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, /* Create domain user */ acb_info = ACB_NORMAL; - acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR | - SAMR_USER_SETATTR; + acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, acct_name, acb_info, acct_flags, @@ -5378,11 +5379,12 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, } /* Create trusting domain's account */ - acb_info = ACB_NORMAL; - acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR | - SAMR_USER_SETATTR; + acb_info = ACB_NORMAL; + acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, acct_name, acb_info, acct_flags, diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 5c3fb2b2ff..271219938e 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -250,11 +250,14 @@ int net_rpc_join_newstyle(int argc, const char **argv) strlower_m(acct_name); const_acct_name = acct_name; - acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE | - SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC | - SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR | - SAMR_USER_SETATTR; + acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE | + SEC_STD_WRITE_DAC | SEC_STD_DELETE | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_ATTRIBUTES; + DEBUG(10, ("Creating account with flags: %d\n",acct_flags)); + result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, acct_name, acb_info, acct_flags, &user_pol, diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index fe0c22911e..76036bfdde 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1008,6 +1008,62 @@ static bool do_dump_event_list(struct messaging_context *msg_ctx, return send_message(msg_ctx, pid, MSG_DUMP_EVENT_LIST, NULL, 0); } +static bool do_winbind_dump_domain_list(struct messaging_context *msg_ctx, + const struct server_id pid, + const int argc, const char **argv) +{ + const char *domain = NULL; + int domain_len = 0; + struct server_id myid; + uint8_t *buf = NULL; + int buf_len = 0; + + myid = pid_to_procid(sys_getpid()); + + if (argc < 1 || argc > 2) { + fprintf(stderr, "Usage: smbcontrol <dest> dump_domain_list " + "<domain>\n"); + return false; + } + + if (argc == 2) { + domain = argv[1]; + domain_len = strlen(argv[1]) + 1; + } + + messaging_register(msg_ctx, NULL, MSG_WINBIND_DUMP_DOMAIN_LIST, + print_pid_string_cb); + + buf_len = sizeof(myid)+domain_len; + buf = SMB_MALLOC(buf_len); + if (!buf) { + return false; + } + + memcpy(buf, &myid, sizeof(myid)); + memcpy(&buf[sizeof(myid)], domain, domain_len); + + if (!send_message(msg_ctx, pid, MSG_WINBIND_DUMP_DOMAIN_LIST, + buf, buf_len)) + { + SAFE_FREE(buf); + return false; + } + + wait_replies(msg_ctx, procid_to_pid(&pid) == 0); + + /* No replies were received within the timeout period */ + + SAFE_FREE(buf); + if (num_replies == 0) { + printf("No replies received\n"); + } + + messaging_deregister(msg_ctx, MSG_WINBIND_DUMP_DOMAIN_LIST, NULL); + + return num_replies; +} + static void winbind_validate_cache_cb(struct messaging_context *msg, void *private_data, uint32_t msg_type, @@ -1150,6 +1206,7 @@ static const struct { { "dump-event-list", do_dump_event_list, "Dump event list"}, { "validate-cache" , do_winbind_validate_cache, "Validate winbind's credential cache" }, + { "dump-domain-list", do_winbind_dump_domain_list, "Dump winbind domain list"}, { "noop", do_noop, "Do nothing" }, { NULL } }; diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 5e9900d1d6..615f4a918e 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1227,6 +1227,10 @@ int main(int argc, char **argv, char **envp) MSG_WINBIND_VALIDATE_CACHE, winbind_msg_validate_cache); + messaging_register(winbind_messaging_context(), NULL, + MSG_WINBIND_DUMP_DOMAIN_LIST, + winbind_msg_dump_domain_list); + netsamlogon_cache_init(); /* Non-critical */ /* clear the cached list of trusted domains */ diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index dbc664da8c..94910072c3 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -679,8 +679,22 @@ static NTSTATUS get_trust_creds(const struct winbindd_domain *domain, char **machine_krb5_principal) { const char *account_name; + const char *name = NULL; + + /* If we are a DC and this is not our own domain */ - if (!get_trust_pw_clear(domain->name, machine_password, + if (IS_DC) { + name = domain->name; + } else { + struct winbindd_domain *our_domain = find_our_domain(); + + if (!our_domain) + return NT_STATUS_INVALID_SERVER_STATE; + + name = our_domain->name; + } + + if (!get_trust_pw_clear(name, machine_password, &account_name, NULL)) { return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; @@ -1805,17 +1819,17 @@ static bool set_dc_type_and_flags_trustinfo( struct winbindd_domain *domain ) static void set_dc_type_and_flags_connect( struct winbindd_domain *domain ) { NTSTATUS result; - DS_DOMINFO_CTR ctr; + WERROR werr; TALLOC_CTX *mem_ctx = NULL; struct rpc_pipe_client *cli; POLICY_HND pol; + union dssetup_DsRoleInfo info; const char *domain_name = NULL; const char *dns_name = NULL; const char *forest_name = NULL; DOM_SID *dom_sid = NULL; - ZERO_STRUCT( ctr ); if (!connection_ok(domain)) { return; @@ -1830,24 +1844,25 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain ) DEBUG(5, ("set_dc_type_and_flags_connect: domain %s\n", domain->name )); - cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_LSARPC_DS, + cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_DSSETUP, &result); if (cli == NULL) { DEBUG(5, ("set_dc_type_and_flags_connect: Could not bind to " - "PI_LSARPC_DS on domain %s: (%s)\n", + "PI_DSSETUP on domain %s: (%s)\n", domain->name, nt_errstr(result))); /* if this is just a non-AD domain we need to continue * identifying so that we can in the end return with * domain->initialized = True - gd */ - goto no_lsarpc_ds; + goto no_dssetup; } - result = rpccli_ds_getprimarydominfo(cli, mem_ctx, - DsRolePrimaryDomainInfoBasic, - &ctr); + result = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(cli, mem_ctx, + DS_ROLE_BASIC_INFORMATION, + &info, + &werr); cli_rpc_pipe_close(cli); if (!NT_STATUS_IS_OK(result)) { @@ -1856,26 +1871,26 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain ) domain->name, nt_errstr(result))); /* older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for - * every opcode on the LSARPC_DS pipe, continue with - * no_lsarpc_ds mode here as well to get domain->initialized + * every opcode on the DSSETUP pipe, continue with + * no_dssetup mode here as well to get domain->initialized * set - gd */ if (NT_STATUS_V(result) == DCERPC_FAULT_OP_RNG_ERROR) { - goto no_lsarpc_ds; + goto no_dssetup; } TALLOC_FREE(mem_ctx); return; } - - if ((ctr.basic->flags & DSROLE_PRIMARY_DS_RUNNING) && - !(ctr.basic->flags & DSROLE_PRIMARY_DS_MIXED_MODE)) { + + if ((info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING) && + !(info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE)) { domain->native_mode = True; } else { domain->native_mode = False; } -no_lsarpc_ds: +no_dssetup: cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_LSARPC, &result); if (cli == NULL) { diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index e21524689b..15ca564c6a 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -676,6 +676,88 @@ void winbind_msg_dump_event_list(struct messaging_context *msg_ctx, } +void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + TALLOC_CTX *mem_ctx; + const char *message = NULL; + struct server_id *sender = NULL; + const char *domain = NULL; + char *s = NULL; + NTSTATUS status; + struct winbindd_domain *dom = NULL; + + DEBUG(5,("winbind_msg_dump_domain_list received.\n")); + + if (!data || !data->data) { + return; + } + + if (data->length < sizeof(struct server_id)) { + return; + } + + mem_ctx = talloc_init("winbind_msg_dump_domain_list"); + if (!mem_ctx) { + return; + } + + sender = (struct server_id *)data->data; + if (data->length > sizeof(struct server_id)) { + domain = (const char *)data->data+sizeof(struct server_id); + } + + if (domain) { + + DEBUG(5,("winbind_msg_dump_domain_list for domain: %s\n", + domain)); + + message = NDR_PRINT_STRUCT_STRING(mem_ctx, winbindd_domain, + find_domain_from_name_noinit(domain)); + if (!message) { + talloc_destroy(mem_ctx); + return; + } + + messaging_send_buf(msg_ctx, *sender, + MSG_WINBIND_DUMP_DOMAIN_LIST, + (uint8_t *)message, strlen(message) + 1); + + talloc_destroy(mem_ctx); + + return; + } + + DEBUG(5,("winbind_msg_dump_domain_list all domains\n")); + + for (dom = domain_list(); dom; dom=dom->next) { + message = NDR_PRINT_STRUCT_STRING(mem_ctx, winbindd_domain, dom); + if (!message) { + talloc_destroy(mem_ctx); + return; + } + + s = talloc_asprintf_append(s, "%s\n", message); + if (!s) { + talloc_destroy(mem_ctx); + return; + } + } + + status = messaging_send_buf(msg_ctx, *sender, + MSG_WINBIND_DUMP_DOMAIN_LIST, + (uint8_t *)s, strlen(s) + 1); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("failed to send message: %s\n", + nt_errstr(status))); + } + + talloc_destroy(mem_ctx); +} + static void account_lockout_policy_handler(struct event_context *ctx, struct timed_event *te, const struct timeval *now, @@ -877,6 +959,13 @@ static bool fork_domain_child(struct winbindd_child *child) struct winbindd_cli_state state; struct winbindd_domain *domain; + if (child->domain) { + DEBUG(10, ("fork_domain_child called for domain '%s'\n", + child->domain->name)); + } else { + DEBUG(10, ("fork_domain_child called without domain.\n")); + } + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) { DEBUG(0, ("Could not open child pipe: %s\n", strerror(errno))); @@ -946,6 +1035,8 @@ static bool fork_domain_child(struct winbindd_child *child) MSG_WINBIND_ONLINESTATUS, NULL); messaging_deregister(winbind_messaging_context(), MSG_DUMP_EVENT_LIST, NULL); + messaging_deregister(winbind_messaging_context(), + MSG_WINBIND_DUMP_DOMAIN_LIST, NULL); /* Handle online/offline messages. */ messaging_register(winbind_messaging_context(), NULL, diff --git a/source3/winbindd/winbindd_ndr.c b/source3/winbindd/winbindd_ndr.c new file mode 100644 index 0000000000..842c915c5f --- /dev/null +++ b/source3/winbindd/winbindd_ndr.c @@ -0,0 +1,153 @@ +/* + * Unix SMB/CIFS implementation. + * winbindd debug helper + * 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" +#include "winbindd.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_WINBIND + +/**************************************************************** +****************************************************************/ + +void ndr_print_winbindd_child(struct ndr_print *ndr, + const char *name, + const struct winbindd_child *r) +{ + ndr_print_struct(ndr, name, "winbindd_child"); + ndr->depth++; + ndr_print_ptr(ndr, "next", r->next); + ndr_print_ptr(ndr, "prev", r->prev); + ndr_print_uint32(ndr, "pid", (uint32_t)r->pid); +#if 0 + ndr_print_winbindd_domain(ndr, "domain", r->domain); +#else + ndr_print_ptr(ndr, "domain", r->domain); +#endif + ndr_print_string(ndr, "logfilename", r->logfilename); + /* struct fd_event event; */ + ndr_print_ptr(ndr, "lockout_policy_event", r->lockout_policy_event); + ndr_print_ptr(ndr, "requests", r->requests); + ndr_print_ptr(ndr, "table", r->table); + ndr->depth--; +} + +/**************************************************************** +****************************************************************/ + +void ndr_print_winbindd_cm_conn(struct ndr_print *ndr, + const char *name, + const struct winbindd_cm_conn *r) +{ + ndr_print_struct(ndr, name, "winbindd_cm_conn"); + ndr->depth++; + ndr_print_ptr(ndr, "cli", r->cli); + ndr_print_ptr(ndr, "samr_pipe", r->samr_pipe); + ndr_print_policy_handle(ndr, "sam_connect_handle", &r->sam_connect_handle); + ndr_print_policy_handle(ndr, "sam_domain_handle", &r->sam_domain_handle); + ndr_print_ptr(ndr, "lsa_pipe", r->lsa_pipe); + ndr_print_policy_handle(ndr, "lsa_policy", &r->lsa_policy); + ndr_print_ptr(ndr, "netlogon_pipe", r->netlogon_pipe); + ndr->depth--; +} + +/**************************************************************** +****************************************************************/ + +void ndr_print_winbindd_methods(struct ndr_print *ndr, + const char *name, + const struct winbindd_methods *r) +{ +#ifdef HAVE_ADS + extern struct winbindd_methods ads_methods; +#endif + extern struct winbindd_methods msrpc_methods; + extern struct winbindd_methods passdb_methods; + extern struct winbindd_methods reconnect_methods; + extern struct winbindd_methods cache_methods; + + ndr_print_struct(ndr, name, "winbindd_methods"); + ndr->depth++; + + if (r == NULL) { + ndr_print_string(ndr, name, "(NULL)"); + ndr->depth--; + return; + } + + if (r == &msrpc_methods) { + ndr_print_string(ndr, name, "msrpc_methods"); +#ifdef HAVE_ADS + } else if (r == &ads_methods) { + ndr_print_string(ndr, name, "ads_methods"); +#endif + } else if (r == &passdb_methods) { + ndr_print_string(ndr, name, "passdb_methods"); + } else if (r == &reconnect_methods) { + ndr_print_string(ndr, name, "reconnect_methods"); + } else if (r == &cache_methods) { + ndr_print_string(ndr, name, "cache_methods"); + } else { + ndr_print_string(ndr, name, "UNKNOWN"); + } + ndr->depth--; +} + +/**************************************************************** +****************************************************************/ + +void ndr_print_winbindd_domain(struct ndr_print *ndr, + const char *name, + const struct winbindd_domain *r) +{ + if (!r) { + return; + } + + ndr_print_struct(ndr, name, "winbindd_domain"); + ndr->depth++; + ndr_print_string(ndr, "name", r->name); + ndr_print_string(ndr, "alt_name", r->alt_name); + ndr_print_string(ndr, "forest_name", r->forest_name); + ndr_print_dom_sid(ndr, "sid", &r->sid); + ndr_print_netr_TrustFlags(ndr, "domain_flags", r->domain_flags); + ndr_print_netr_TrustType(ndr, "domain_type", r->domain_type); + ndr_print_netr_TrustAttributes(ndr, "domain_trust_attribs", r->domain_trust_attribs); + ndr_print_bool(ndr, "initialized", r->initialized); + ndr_print_bool(ndr, "native_mode", r->native_mode); + ndr_print_bool(ndr, "active_directory", r->active_directory); + ndr_print_bool(ndr, "primary", r->primary); + ndr_print_bool(ndr, "internal", r->internal); + ndr_print_bool(ndr, "online", r->online); + ndr_print_time_t(ndr, "startup_time", r->startup_time); + ndr_print_bool(ndr, "startup", r->startup); + ndr_print_winbindd_methods(ndr, "methods", r->methods); + ndr_print_winbindd_methods(ndr, "backend", r->backend); + ndr_print_ptr(ndr, "private_data", r->private_data); + ndr_print_string(ndr, "dcname", r->dcname); + ndr_print_sockaddr_storage(ndr, "dcaddr", &r->dcaddr); + ndr_print_time_t(ndr, "last_seq_check", r->last_seq_check); + ndr_print_uint32(ndr, "sequence_number", r->sequence_number); + ndr_print_NTSTATUS(ndr, "last_status", r->last_status); + ndr_print_winbindd_cm_conn(ndr, "conn", &r->conn); + ndr_print_winbindd_child(ndr, "child", &r->child); + ndr_print_uint32(ndr, "check_online_timeout", r->check_online_timeout); + ndr_print_ptr(ndr, "check_online_event", r->check_online_event); + ndr->depth--; +} diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 0381053331..f6bb5750ea 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -571,7 +571,7 @@ enum winbindd_result init_child_connection(struct winbindd_domain *domain, /* The primary domain has to find the DC name itself */ request->cmd = WINBINDD_INIT_CONNECTION; fstrcpy(request->domain_name, domain->name); - request->data.init_conn.is_primary = domain->internal ? False : True; + request->data.init_conn.is_primary = domain->primary ? true : false; fstrcpy(request->data.init_conn.dcname, ""); async_request(mem_ctx, &domain->child, request, response, init_child_recv, state); @@ -1386,31 +1386,56 @@ void ws_name_return( char *name, char replace ) /********************************************************************* ********************************************************************/ -bool winbindd_can_contact_domain( struct winbindd_domain *domain ) +bool winbindd_can_contact_domain(struct winbindd_domain *domain) { + struct winbindd_tdc_domain *tdc = NULL; + TALLOC_CTX *frame = talloc_stackframe(); + bool ret = false; + /* We can contact the domain if it is our primary domain */ - if ( domain->primary ) - return True; + if (domain->primary) { + return true; + } - /* Can always contact a domain that is in out forest */ + /* Trust the TDC cache and not the winbindd_domain flags */ - if ( domain->domain_flags & DS_DOMAIN_IN_FOREST ) - return True; + if ((tdc = wcache_tdc_fetch_domain(frame, domain->name)) == NULL) { + DEBUG(10,("winbindd_can_contact_domain: %s not found in cache\n", + domain->name)); + return false; + } - /* We cannot contact the domain if it is running AD and - we have no inbound trust */ + /* Can always contact a domain that is in out forest */ - if ( domain->active_directory && - ((domain->domain_flags&DS_DOMAIN_DIRECT_INBOUND) != DS_DOMAIN_DIRECT_INBOUND) ) - { - return False; + if (tdc->trust_flags & DS_DOMAIN_IN_FOREST) { + ret = true; + goto done; } + /* + * On a _member_ server, we cannot contact the domain if it + * is running AD and we have no inbound trust. + */ + + if (!IS_DC && + domain->active_directory && + ((tdc->trust_flags&DS_DOMAIN_DIRECT_INBOUND) != DS_DOMAIN_DIRECT_INBOUND)) + { + DEBUG(10, ("winbindd_can_contact_domain: %s is an AD domain " + "and we have no inbound trust.\n", domain->name)); + goto done; + } + /* Assume everything else is ok (probably not true but what can you do?) */ + + ret = true; + +done: + talloc_destroy(frame); - return True; + return ret; } /********************************************************************* |