From e9017ba418202b4b191c5a9ad4a96857558ce606 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 17:22:58 +0200 Subject: Use _OBJ_FILES variables in a couple more places. (This used to be commit 92856d5054106894b65cd1a1b5119c0facfc4cff) --- source4/librpc/config.mk | 439 ++++++++++++++++++++++++++++++----------------- 1 file changed, 282 insertions(+), 157 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 0a265c7004..abf7a434d0 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -5,24 +5,23 @@ VERSION = 0.0.1 SO_VERSION = 0 PC_FILE = ndr.pc PRIVATE_PROTO_HEADER = ndr/libndr_proto.h -OBJ_FILES = \ - ndr/ndr.o \ - ndr/ndr_basic.o \ - ndr/ndr_string.o \ - ndr/uuid.o PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET \ LIBSAMBA-HOSTCONFIG # End SUBSYSTEM LIBNDR ################################################ +LIBNDR_OBJ_FILES = \ + librpc/ndr/ndr.o \ + librpc/ndr/ndr_basic.o \ + librpc/ndr/ndr_string.o \ + librpc/ndr/uuid.o + PUBLIC_HEADERS += librpc/ndr/libndr.h ################################# # Start BINARY ndrdump [BINARY::ndrdump] INSTALLDIR = BINDIR -OBJ_FILES = \ - tools/ndrdump.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -34,258 +33,317 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ndrdump ################################# +ndrdump_OBJ_FILES = librpc/tools/ndrdump.o + MANPAGES += librpc/tools/ndrdump.1 ################################################ # Start SUBSYSTEM NDR_COMPRESSION [SUBSYSTEM::NDR_COMPRESSION] PRIVATE_PROTO_HEADER = ndr/ndr_compression.h -OBJ_FILES = \ - ndr/ndr_compression.o PUBLIC_DEPENDENCIES = LIBCOMPRESSION LIBSAMBA-ERRORS LIBNDR # End SUBSYSTEM NDR_COMPRESSION ################################################ +NDR_COMPRESSION_OBJ_FILES = librpc/ndr/ndr_compression.o + [SUBSYSTEM::NDR_SECURITY] -OBJ_FILES = gen_ndr/ndr_security.o ndr/ndr_sec_helper.o PUBLIC_DEPENDENCIES = NDR_MISC LIBSECURITY +NDR_SECURITY_OBJ_FILES = librpc/gen_ndr/ndr_security.o librpc/ndr/ndr_sec_helper.o + PUBLIC_HEADERS += librpc/gen_ndr/security.h [SUBSYSTEM::NDR_AUDIOSRV] -OBJ_FILES = gen_ndr/ndr_audiosrv.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_AUDIOSRV_OBJ_FILES = librpc/gen_ndr/ndr_audiosrv.o + [SUBSYSTEM::NDR_DNSSERVER] -OBJ_FILES = gen_ndr/ndr_dnsserver.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DNSSERVER_OBJ_FILES = librpc/gen_ndr/ndr_dnsserver.o + [SUBSYSTEM::NDR_WINSTATION] -OBJ_FILES = gen_ndr/ndr_winstation.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WINSTATION_OBJ_FILES = librpc/gen_ndr/ndr_winstation.o + [SUBSYSTEM::NDR_ECHO] -OBJ_FILES = gen_ndr/ndr_echo.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo.o + [SUBSYSTEM::NDR_IRPC] -OBJ_FILES = gen_ndr/ndr_irpc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_NBT +NDR_IRPC_OBJ_FILES = librpc/gen_ndr/ndr_irpc.o + [SUBSYSTEM::NDR_DSBACKUP] -OBJ_FILES = gen_ndr/ndr_dsbackup.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DSBACKUP_OBJ_FILES = librpc/gen_ndr/ndr_dsbackup.o + [SUBSYSTEM::NDR_EFS] -OBJ_FILES = gen_ndr/ndr_efs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_EFS_OBJ_FILES = librpc/gen_ndr/ndr_efs.o + [SUBSYSTEM::NDR_MISC] -OBJ_FILES = gen_ndr/ndr_misc.o ndr/ndr_misc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MISC_OBJ_FILES = librpc/gen_ndr/ndr_misc.o librpc/ndr/ndr_misc.o + PUBLIC_HEADERS += librpc/gen_ndr/misc.h librpc/gen_ndr/ndr_misc.h [SUBSYSTEM::NDR_ROT] -OBJ_FILES = gen_ndr/ndr_rot.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC +NDR_ROT_OBJ_FILES = librpc/gen_ndr/ndr_rot.o + [SUBSYSTEM::NDR_LSA] -OBJ_FILES = gen_ndr/ndr_lsa.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa.o + PUBLIC_HEADERS += librpc/gen_ndr/lsa.h [SUBSYSTEM::NDR_DFS] -OBJ_FILES = gen_ndr/ndr_dfs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs.o + [SUBSYSTEM::NDR_FRSRPC] -OBJ_FILES = gen_ndr/ndr_frsrpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_FRSRPC_OBJ_FILES = librpc/gen_ndr/ndr_frsrpc.o + [SUBSYSTEM::NDR_FRSAPI] -OBJ_FILES = gen_ndr/ndr_frsapi.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_FRSAPI_OBJ_FILES = librpc/gen_ndr/ndr_frsapi.o + [SUBSYSTEM::NDR_DRSUAPI] -OBJ_FILES = gen_ndr/ndr_drsuapi.o ndr/ndr_drsuapi.o PUBLIC_DEPENDENCIES = LIBNDR NDR_COMPRESSION NDR_SECURITY NDR_SAMR ASN1_UTIL +NDR_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi.o librpc/ndr/ndr_drsuapi.o + [SUBSYSTEM::NDR_DRSBLOBS] -OBJ_FILES = gen_ndr/ndr_drsblobs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI +NDR_DRSBLOBS_OBJ_FILES = librpc/gen_ndr/ndr_drsblobs.o + [SUBSYSTEM::NDR_SASL_HELPERS] -OBJ_FILES = gen_ndr/ndr_sasl_helpers.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_SASL_HELPERS_OBJ_FILES = librpc/gen_ndr/ndr_sasl_helpers.o + [SUBSYSTEM::NDR_POLICYAGENT] -OBJ_FILES = gen_ndr/ndr_policyagent.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_POLICYAGENT_OBJ_FILES = librpc/gen_ndr/ndr_policyagent.o + [SUBSYSTEM::NDR_UNIXINFO] -OBJ_FILES = gen_ndr/ndr_unixinfo.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo.o + [SUBSYSTEM::NDR_SAMR] -OBJ_FILES = gen_ndr/ndr_samr.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_LSA NDR_SECURITY +NDR_SAMR_OBJ_FILES = librpc/gen_ndr/ndr_samr.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/samr.h gen_ndr/ndr_samr.h gen_ndr/ndr_samr_c.h) [SUBSYSTEM::NDR_NFS4ACL] -OBJ_FILES = gen_ndr/ndr_nfs4acl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_SECURITY +NDR_NFS4ACL_OBJ_FILES = librpc/gen_ndr/ndr_nfs4acl.o + [SUBSYSTEM::NDR_SPOOLSS] -OBJ_FILES = gen_ndr/ndr_spoolss.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SPOOLSS_BUF NDR_SECURITY +NDR_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss.o + [SUBSYSTEM::NDR_SPOOLSS_BUF] PRIVATE_PROTO_HEADER = ndr/ndr_spoolss_buf.h -OBJ_FILES = ndr/ndr_spoolss_buf.o + +NDR_SPOOLSS_BUF_OBJ_FILES = librpc/ndr/ndr_spoolss_buf.o [SUBSYSTEM::NDR_WKSSVC] -OBJ_FILES = gen_ndr/ndr_wkssvc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SRVSVC NDR_MISC NDR_SECURITY +NDR_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc.o + [SUBSYSTEM::NDR_SRVSVC] -OBJ_FILES = gen_ndr/ndr_srvsvc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SVCCTL NDR_SECURITY +NDR_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc.o + [SUBSYSTEM::NDR_SVCCTL] -OBJ_FILES = gen_ndr/ndr_svcctl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/ndr_svcctl.h gen_ndr/svcctl.h) [SUBSYSTEM::NDR_ATSVC] -OBJ_FILES = gen_ndr/ndr_atsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ATSVC_OBJ_FILES = librpc/gen_ndr/ndr_atsvc.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/atsvc.h gen_ndr/ndr_atsvc.h) [SUBSYSTEM::NDR_EVENTLOG] -OBJ_FILES = gen_ndr/ndr_eventlog.o PUBLIC_DEPENDENCIES = LIBNDR NDR_LSA +NDR_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog.o + [SUBSYSTEM::NDR_EPMAPPER] -OBJ_FILES = gen_ndr/ndr_epmapper.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_EPMAPPER_OBJ_FILES = librpc/gen_ndr/ndr_epmapper.o + [SUBSYSTEM::NDR_DBGIDL] -OBJ_FILES = gen_ndr/ndr_dbgidl.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DBGIDL_OBJ_FILES = librpc/gen_ndr/ndr_dbgidl.o + [SUBSYSTEM::NDR_DSSETUP] -OBJ_FILES = gen_ndr/ndr_dssetup.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DSSETUP_OBJ_FILES = librpc/gen_ndr/ndr_dssetup.o + [SUBSYSTEM::NDR_MSGSVC] -OBJ_FILES = gen_ndr/ndr_msgsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MSGSVC_OBJ_FILES = librpc/gen_ndr/ndr_msgsvc.o + [SUBSYSTEM::NDR_WINS] -OBJ_FILES = gen_ndr/ndr_wins.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WINS_OBJ_FILES = librpc/gen_ndr/ndr_wins.o + [SUBSYSTEM::NDR_WINREG] -OBJ_FILES = gen_ndr/ndr_winreg.o PUBLIC_DEPENDENCIES = LIBNDR NDR_INITSHUTDOWN NDR_SECURITY NDR_MISC +NDR_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg.o + [SUBSYSTEM::NDR_INITSHUTDOWN] -OBJ_FILES = gen_ndr/ndr_initshutdown.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown.o + [SUBSYSTEM::NDR_MGMT] -OBJ_FILES = gen_ndr/ndr_mgmt.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MGMT_OBJ_FILES = librpc/gen_ndr/ndr_mgmt.o + [SUBSYSTEM::NDR_PROTECTED_STORAGE] -OBJ_FILES = gen_ndr/ndr_protected_storage.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_PROTECTED_STORAGE_OBJ_FILES = librpc/gen_ndr/ndr_protected_storage.o + [SUBSYSTEM::NDR_ORPC] -OBJ_FILES = gen_ndr/ndr_orpc.o ndr/ndr_orpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ORPC_OBJ_FILES = librpc/gen_ndr/ndr_orpc.o librpc/ndr/ndr_orpc.o + [SUBSYSTEM::NDR_OXIDRESOLVER] -OBJ_FILES = gen_ndr/ndr_oxidresolver.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC +NDR_OXIDRESOLVER_OBJ_FILES = librpc/gen_ndr/ndr_oxidresolver.o + [SUBSYSTEM::NDR_REMACT] -OBJ_FILES = gen_ndr/ndr_remact.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC +NDR_REMACT_OBJ_FILES = librpc/gen_ndr/ndr_remact.o + [SUBSYSTEM::NDR_WZCSVC] -OBJ_FILES = gen_ndr/ndr_wzcsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WZCSVC_OBJ_FILES = librpc/gen_ndr/ndr_wzcsvc.o + [SUBSYSTEM::NDR_BROWSER] -OBJ_FILES = gen_ndr/ndr_browser.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_BROWSER_OBJ_FILES = librpc/gen_ndr/ndr_browser.o + [SUBSYSTEM::NDR_W32TIME] -OBJ_FILES = gen_ndr/ndr_w32time.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_W32TIME_OBJ_FILES = librpc/gen_ndr/ndr_w32time.o + [SUBSYSTEM::NDR_SCERPC] -OBJ_FILES = gen_ndr/ndr_scerpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_SCERPC_OBJ_FILES = librpc/gen_ndr/ndr_scerpc.o + [SUBSYSTEM::NDR_NTSVCS] -OBJ_FILES = gen_ndr/ndr_ntsvcs.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_NTSVCS_OBJ_FILES = librpc/gen_ndr/ndr_ntsvcs.o + [SUBSYSTEM::NDR_NETLOGON] -OBJ_FILES = gen_ndr/ndr_netlogon.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SAMR NDR_LSA NDR_SECURITY +NDR_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/netlogon.h) [SUBSYSTEM::NDR_TRKWKS] -OBJ_FILES = gen_ndr/ndr_trkwks.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_TRKWKS_OBJ_FILES = librpc/gen_ndr/ndr_trkwks.o + [SUBSYSTEM::NDR_KEYSVC] -OBJ_FILES = gen_ndr/ndr_keysvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_KEYSVC_OBJ_FILES = librpc/gen_ndr/ndr_keysvc.o + [SUBSYSTEM::NDR_KRB5PAC] -OBJ_FILES = gen_ndr/ndr_krb5pac.o ndr/ndr_krb5pac.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON NDR_SECURITY +NDR_KRB5PAC_OBJ_FILES = librpc/gen_ndr/ndr_krb5pac.o librpc/ndr/ndr_krb5pac.o + [SUBSYSTEM::NDR_XATTR] -OBJ_FILES = gen_ndr/ndr_xattr.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_XATTR_OBJ_FILES = librpc/gen_ndr/ndr_xattr.o + [SUBSYSTEM::NDR_OPENDB] -OBJ_FILES = gen_ndr/ndr_opendb.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_OPENDB_OBJ_FILES = librpc/gen_ndr/ndr_opendb.o + [SUBSYSTEM::NDR_NOTIFY] -OBJ_FILES = gen_ndr/ndr_notify.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_NOTIFY_OBJ_FILES = librpc/gen_ndr/ndr_notify.o + [SUBSYSTEM::NDR_SCHANNEL] -OBJ_FILES = gen_ndr/ndr_schannel.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT +NDR_SCHANNEL_OBJ_FILES = librpc/gen_ndr/ndr_schannel.o + [SUBSYSTEM::NDR_NBT] -OBJ_FILES = gen_ndr/ndr_nbt.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_NBT_BUF NDR_SVCCTL NDR_SECURITY +NDR_NBT_OBJ_FILES = librpc/gen_ndr/ndr_nbt.o + PUBLIC_HEADERS += librpc/gen_ndr/nbt.h [SUBSYSTEM::NDR_WINSREPL] -OBJ_FILES = gen_ndr/ndr_winsrepl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT +NDR_WINSREPL_OBJ_FILES = librpc/gen_ndr/ndr_winsrepl.o + [SUBSYSTEM::NDR_WINBIND] -OBJ_FILES = gen_ndr/ndr_winbind.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON +NDR_WINBIND_OBJ_FILES = librpc/gen_ndr/ndr_winbind.o +PUBLIC_HEADERS += librpc/gen_ndr/winbind.h + librpc/idl-deps: ./librpc/idl-deps.pl librpc/idl/*.idl >$@ @@ -300,7 +358,6 @@ librpc/gen_ndr/tables.c: $(IDL_NDR_PARSE_H_FILES) @mv librpc/gen_ndr/tables.x $@ [SUBSYSTEM::NDR_TABLE] -OBJ_FILES = ndr/ndr_table.o gen_ndr/tables.o PRIVATE_PROTO_HEADER = ndr/ndr_table.h PUBLIC_DEPENDENCIES = \ NDR_AUDIOSRV NDR_ECHO NDR_DCERPC \ @@ -314,164 +371,203 @@ PUBLIC_DEPENDENCIES = \ NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_OPENDB \ NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL +NDR_TABLE_OBJ_FILES = librpc/ndr/ndr_table.o librpc/gen_ndr/tables.o + [SUBSYSTEM::RPC_NDR_ROT] -OBJ_FILES = gen_ndr/ndr_rot_c.o PUBLIC_DEPENDENCIES = NDR_ROT dcerpc +RPC_NDR_ROT_OBJ_FILES = librpc/gen_ndr/ndr_rot_c.o + [SUBSYSTEM::RPC_NDR_AUDIOSRV] -OBJ_FILES = gen_ndr/ndr_audiosrv_c.o PUBLIC_DEPENDENCIES = NDR_AUDIOSRV dcerpc +RPC_NDR_AUDIOSRV_OBJ_FILES = librpc/gen_ndr/ndr_audiosrv_c.o + [SUBSYSTEM::RPC_NDR_ECHO] -OBJ_FILES = gen_ndr/ndr_echo_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO +RPC_NDR_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo_c.o + [SUBSYSTEM::RPC_NDR_DSBACKUP] -OBJ_FILES = gen_ndr/ndr_dsbackup_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DSBACKUP +RPC_NDR_DSBACKUP_OBJ_FILES = librpc/gen_ndr/ndr_dsbackup_c.o + [SUBSYSTEM::RPC_NDR_EFS] -OBJ_FILES = gen_ndr/ndr_efs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_EFS +RPC_NDR_EFS_OBJ_FILES = librpc/gen_ndr/ndr_efs_c.o + [SUBSYSTEM::RPC_NDR_LSA] -OBJ_FILES = gen_ndr/ndr_lsa_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_LSA +RPC_NDR_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa_c.o + [SUBSYSTEM::RPC_NDR_DFS] -OBJ_FILES = gen_ndr/ndr_dfs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DFS +RPC_NDR_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs_c.o + [SUBSYSTEM::RPC_NDR_FRSAPI] -OBJ_FILES = gen_ndr/ndr_frsapi_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_FRSAPI +RPC_NDR_FRSAPI_OBJ_FILES = librpc/gen_ndr/ndr_frsapi_c.o + [SUBSYSTEM::RPC_NDR_DRSUAPI] -OBJ_FILES = gen_ndr/ndr_drsuapi_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI +RPC_NDR_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi_c.o + [SUBSYSTEM::RPC_NDR_POLICYAGENT] -OBJ_FILES = gen_ndr/ndr_policyagent_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_POLICYAGENT +RPC_NDR_POLICYAGENT_OBJ_FILES = librpc/gen_ndr/ndr_policyagent_c.o + [SUBSYSTEM::RPC_NDR_UNIXINFO] -OBJ_FILES = gen_ndr/ndr_unixinfo_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO +RPC_NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo_c.o + [LIBRARY::dcerpc_samr] -OBJ_FILES = gen_ndr/ndr_samr_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR PC_FILE = dcerpc_samr.pc VERSION = 0.0.1 SO_VERSION = 0 +dcerpc_samr_OBJ_FILES = librpc/gen_ndr/ndr_samr_c.o + [SUBSYSTEM::RPC_NDR_SPOOLSS] -OBJ_FILES = gen_ndr/ndr_spoolss_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS +RPC_NDR_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss_c.o + [SUBSYSTEM::RPC_NDR_WKSSVC] -OBJ_FILES = gen_ndr/ndr_wkssvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC +RPC_NDR_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc_c.o + [SUBSYSTEM::RPC_NDR_SRVSVC] -OBJ_FILES = gen_ndr/ndr_srvsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC +RPC_NDR_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc_c.o + [SUBSYSTEM::RPC_NDR_SVCCTL] -OBJ_FILES = gen_ndr/ndr_svcctl_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL +RPC_NDR_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl_c.o + PUBLIC_HEADERS += librpc/gen_ndr/ndr_svcctl_c.h [LIBRARY::dcerpc_atsvc] -OBJ_FILES = gen_ndr/ndr_atsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC PC_FILE = dcerpc_atsvc.pc VERSION = 0.0.1 SO_VERSION = 0 +dcerpc_atsvc_OBJ_FILES = librpc/gen_ndr/ndr_atsvc_c.o + PUBLIC_HEADERS += librpc/gen_ndr/ndr_atsvc_c.h [SUBSYSTEM::RPC_NDR_EVENTLOG] -OBJ_FILES = gen_ndr/ndr_eventlog_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG +RPC_NDR_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog_c.o + [SUBSYSTEM::RPC_NDR_EPMAPPER] -OBJ_FILES = gen_ndr/ndr_epmapper_c.o PUBLIC_DEPENDENCIES = NDR_EPMAPPER +RPC_NDR_EPMAPPER_OBJ_FILES = librpc/gen_ndr/ndr_epmapper_c.o + [SUBSYSTEM::RPC_NDR_DBGIDL] -OBJ_FILES = gen_ndr/ndr_dbgidl_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DBGIDL +RPC_NDR_DBGIDL_OBJ_FILES = librpc/gen_ndr/ndr_dbgidl_c.o + [SUBSYSTEM::RPC_NDR_DSSETUP] -OBJ_FILES = gen_ndr/ndr_dssetup_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DSSETUP +RPC_NDR_DSSETUP_OBJ_FILES = librpc/gen_ndr/ndr_dssetup_c.o + [SUBSYSTEM::RPC_NDR_MSGSVC] -OBJ_FILES = gen_ndr/ndr_msgsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_MSGSVC +RPC_NDR_MSGSVC_OBJ_FILES = librpc/gen_ndr/ndr_msgsvc_c.o + [SUBSYSTEM::RPC_NDR_WINS] -OBJ_FILES = gen_ndr/ndr_wins_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WINS +RPC_NDR_WINS_OBJ_FILES = librpc/gen_ndr/ndr_wins_c.o + [SUBSYSTEM::RPC_NDR_WINREG] -OBJ_FILES = gen_ndr/ndr_winreg_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG +RPC_NDR_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg_c.o + [SUBSYSTEM::RPC_NDR_INITSHUTDOWN] -OBJ_FILES = gen_ndr/ndr_initshutdown_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN +RPC_NDR_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown_c.o + [SUBSYSTEM::RPC_NDR_MGMT] -OBJ_FILES = gen_ndr/ndr_mgmt_c.o PRIVATE_DEPENDENCIES = NDR_MGMT +RPC_NDR_MGMT_OBJ_FILES = librpc/gen_ndr/ndr_mgmt_c.o + [SUBSYSTEM::RPC_NDR_PROTECTED_STORAGE] -OBJ_FILES = gen_ndr/ndr_protected_storage_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_PROTECTED_STORAGE +RPC_NDR_PROTECTED_STORAGE_OBJ_FILES = librpc/gen_ndr/ndr_protected_storage_c.o + [SUBSYSTEM::RPC_NDR_OXIDRESOLVER] -OBJ_FILES = gen_ndr/ndr_oxidresolver_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_OXIDRESOLVER +RPC_NDR_OXIDRESOLVER_OBJ_FILES = librpc/gen_ndr/ndr_oxidresolver_c.o + [SUBSYSTEM::RPC_NDR_REMACT] -OBJ_FILES = gen_ndr/ndr_remact_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_REMACT +RPC_NDR_REMACT_OBJ_FILES = librpc/gen_ndr/ndr_remact_c.o + [SUBSYSTEM::RPC_NDR_WZCSVC] -OBJ_FILES = gen_ndr/ndr_wzcsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WZCSVC +RPC_NDR_WZCSVC_OBJ_FILES = librpc/gen_ndr/ndr_wzcsvc_c.o + [SUBSYSTEM::RPC_NDR_W32TIME] -OBJ_FILES = gen_ndr/ndr_w32time_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_W32TIME +RPC_NDR_W32TIME_OBJ_FILES = librpc/gen_ndr/ndr_w32time_c.o + [SUBSYSTEM::RPC_NDR_SCERPC] -OBJ_FILES = gen_ndr/ndr_scerpc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SCERPC +RPC_NDR_SCERPC_OBJ_FILES = librpc/gen_ndr/ndr_scerpc_c.o + [SUBSYSTEM::RPC_NDR_NTSVCS] -OBJ_FILES = gen_ndr/ndr_ntsvcs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_NTSVCS +RPC_NDR_NTSVCS_OBJ_FILES = librpc/gen_ndr/ndr_ntsvcs_c.o + [SUBSYSTEM::RPC_NDR_NETLOGON] -OBJ_FILES = gen_ndr/ndr_netlogon_c.o PUBLIC_DEPENDENCIES = NDR_NETLOGON +RPC_NDR_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon_c.o + [SUBSYSTEM::RPC_NDR_TRKWKS] -OBJ_FILES = gen_ndr/ndr_trkwks_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_TRKWKS +RPC_NDR_TRKWKS_OBJ_FILES = librpc/gen_ndr/ndr_trkwks_c.o + [SUBSYSTEM::RPC_NDR_KEYSVC] -OBJ_FILES = gen_ndr/ndr_keysvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_KEYSVC +RPC_NDR_KEYSVC_OBJ_FILES = librpc/gen_ndr/ndr_keysvc_c.o + [SUBSYSTEM::NDR_DCERPC] -OBJ_FILES = gen_ndr/ndr_dcerpc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DCERPC_OBJ_FILES = librpc/gen_ndr/ndr_dcerpc.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h) ################################################ @@ -481,17 +577,6 @@ VERSION = 0.0.1 SO_VERSION = 0 PC_FILE = dcerpc.pc PRIVATE_PROTO_HEADER = rpc/dcerpc_proto.h -OBJ_FILES = \ - rpc/dcerpc.o \ - rpc/dcerpc_auth.o \ - rpc/dcerpc_schannel.o \ - rpc/dcerpc_util.o \ - rpc/dcerpc_error.o \ - rpc/dcerpc_smb.o \ - rpc/dcerpc_smb2.o \ - rpc/dcerpc_sock.o \ - rpc/dcerpc_connect.o \ - rpc/dcerpc_secondary.o PRIVATE_DEPENDENCIES = \ samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \ LIBNDR NDR_DCERPC RPC_NDR_EPMAPPER \ @@ -503,6 +588,10 @@ PUBLIC_DEPENDENCIES = CREDENTIALS # End SUBSYSTEM dcerpc ################################################ +dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ + dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) + + PUBLIC_HEADERS += $(addprefix librpc/, rpc/dcerpc.h \ gen_ndr/mgmt.h gen_ndr/ndr_mgmt.h gen_ndr/ndr_mgmt_c.h \ gen_ndr/epmapper.h gen_ndr/ndr_epmapper.h gen_ndr/ndr_epmapper_c.h) @@ -510,159 +599,195 @@ PUBLIC_HEADERS += $(addprefix librpc/, rpc/dcerpc.h \ [MODULE::RPC_EJS_ECHO] INIT_FUNCTION = ejs_init_rpcecho -OBJ_FILES = gen_ndr/ndr_echo_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_ECHO EJSRPC +RPC_EJS_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo_ejs.o + [MODULE::RPC_EJS_MISC] INIT_FUNCTION = ejs_init_misc -OBJ_FILES = gen_ndr/ndr_misc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_MISC EJSRPC +RPC_EJS_MISC_OBJ_FILES = librpc/gen_ndr/ndr_misc_ejs.o + [MODULE::RPC_EJS_SAMR] INIT_FUNCTION = ejs_init_samr -OBJ_FILES = gen_ndr/ndr_samr_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SAMR EJSRPC RPC_EJS_LSA RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_SAMR_OBJ_FILES = librpc/gen_ndr/ndr_samr_ejs.o + [MODULE::RPC_EJS_SECURITY] INIT_FUNCTION = ejs_init_security -OBJ_FILES = gen_ndr/ndr_security_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SECURITY EJSRPC +RPC_EJS_SECURITY_OBJ_FILES = librpc/gen_ndr/ndr_security_ejs.o + [MODULE::RPC_EJS_LSA] INIT_FUNCTION = ejs_init_lsarpc -OBJ_FILES = gen_ndr/ndr_lsa_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_LSA EJSRPC RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa_ejs.o + [MODULE::RPC_EJS_DFS] INIT_FUNCTION = ejs_init_netdfs -OBJ_FILES = gen_ndr/ndr_dfs_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_DFS EJSRPC +RPC_EJS_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs_ejs.o + [MODULE::RPC_EJS_DRSUAPI] INIT_FUNCTION = ejs_init_drsuapi -OBJ_FILES = gen_ndr/ndr_drsuapi_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_DRSUAPI EJSRPC RPC_EJS_MISC RPC_EJS_SAMR +RPC_EJS_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi_ejs.o + [MODULE::RPC_EJS_SPOOLSS] INIT_FUNCTION = ejs_init_spoolss -OBJ_FILES = gen_ndr/ndr_spoolss_ejs.o SUBSYSTEM = smbcalls ENABLE = NO PRIVATE_DEPENDENCIES = dcerpc NDR_SPOOLSS EJSRPC +RPC_EJS_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss_ejs.o + [MODULE::RPC_EJS_WKSSVC] INIT_FUNCTION = ejs_init_wkssvc -OBJ_FILES = gen_ndr/ndr_wkssvc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_WKSSVC EJSRPC RPC_EJS_SRVSVC RPC_EJS_MISC +RPC_EJS_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc_ejs.o + [MODULE::RPC_EJS_SRVSVC] INIT_FUNCTION = ejs_init_srvsvc -OBJ_FILES = gen_ndr/ndr_srvsvc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SRVSVC EJSRPC RPC_EJS_MISC RPC_EJS_SVCCTL RPC_EJS_SECURITY +RPC_EJS_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc_ejs.o + [MODULE::RPC_EJS_EVENTLOG] INIT_FUNCTION = ejs_init_eventlog -OBJ_FILES = gen_ndr/ndr_eventlog_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_EVENTLOG EJSRPC RPC_EJS_MISC +RPC_EJS_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog_ejs.o + [MODULE::RPC_EJS_WINREG] INIT_FUNCTION = ejs_init_winreg -OBJ_FILES = gen_ndr/ndr_winreg_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_WINREG EJSRPC RPC_EJS_INITSHUTDOWN \ RPC_EJS_MISC RPC_EJS_SECURITY +RPC_EJS_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg_ejs.o + [MODULE::RPC_EJS_INITSHUTDOWN] INIT_FUNCTION = ejs_init_initshutdown -OBJ_FILES = gen_ndr/ndr_initshutdown_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN EJSRPC +RPC_EJS_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown_ejs.o + [MODULE::RPC_EJS_NETLOGON] INIT_FUNCTION = ejs_init_netlogon -OBJ_FILES = gen_ndr/ndr_netlogon_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_NETLOGON EJSRPC RPC_EJS_SAMR RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon_ejs.o + [MODULE::RPC_EJS_SVCCTL] INIT_FUNCTION = ejs_init_svcctl -OBJ_FILES = gen_ndr/ndr_svcctl_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SVCCTL EJSRPC RPC_EJS_MISC +RPC_EJS_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl_ejs.o + [MODULE::RPC_EJS_IRPC] INIT_FUNCTION = ejs_init_irpc -OBJ_FILES = gen_ndr/ndr_irpc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC +RPC_EJS_IRPC_OBJ_FILES = librpc/gen_ndr/ndr_irpc_ejs.o + [PYTHON::swig_dcerpc] SWIG_FILE = rpc/dcerpc.i PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG dcerpc_samr RPC_NDR_LSA DYNCONFIG +swig_dcerpc_OBJ_FILES = librpc/rpc/dcerpc_wrap.o + [PYTHON::python_echo] -OBJ_FILES = gen_ndr/py_echo.o -PRIVATE_DEPENDENCIES = RPC_NDR_ECHO +PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC + +python_echo_OBJ_FILES = librpc/gen_ndr/py_echo.o [PYTHON::python_winreg] -OBJ_FILES = gen_ndr/py_winreg.o -PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc +PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC + +python_winreg_OBJ_FILES = librpc/gen_ndr/py_winreg.o [PYTHON::python_dcerpc_misc] -OBJ_FILES = gen_ndr/py_misc.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_dcerpc_misc_OBJ_FILES = librpc/gen_ndr/py_misc.o [PYTHON::python_initshutdown] -OBJ_FILES = gen_ndr/py_initshutdown.o -PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN +PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC + +python_initshutdown_OBJ_FILES = librpc/gen_ndr/py_initshutdown.o [PYTHON::python_epmapper] -OBJ_FILES = gen_ndr/py_epmapper.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_epmapper_OBJ_FILES = librpc/gen_ndr/py_epmapper.o [PYTHON::python_mgmt] -OBJ_FILES = gen_ndr/py_mgmt.o -PRIVATE_DEPENDENCIES = dcerpc_mgmt +PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC + +python_mgmt_OBJ_FILES = librpc/gen_ndr/py_mgmt.o [PYTHON::python_atsvc] -OBJ_FILES = gen_ndr/py_atsvc.o -PRIVATE_DEPENDENCIES = dcerpc_atsvc +PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC + +python_atsvc_OBJ_FILES = librpc/gen_ndr/py_atsvc.o [PYTHON::python_samr] -OBJ_FILES = gen_ndr/py_samr.o -PRIVATE_DEPENDENCIES = dcerpc_samr +PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC + +python_samr_OBJ_FILES = librpc/gen_ndr/py_samr.o [PYTHON::python_svcctl] -OBJ_FILES = gen_ndr/py_svcctl.o -PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL +PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC + +python_svcctl_OBJ_FILES = librpc/gen_ndr/py_svcctl.o [PYTHON::python_lsa] -OBJ_FILES = gen_ndr/py_lsa.o -PRIVATE_DEPENDENCIES = RPC_NDR_LSA +PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC + +python_lsa_OBJ_FILES = librpc/gen_ndr/py_lsa.o [PYTHON::python_wkssvc] -OBJ_FILES = gen_ndr/py_wkssvc.o -PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC +PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC + +python_wkssvc_OBJ_FILES = librpc/gen_ndr/py_wkssvc.o [PYTHON::python_dfs] -OBJ_FILES = gen_ndr/py_dfs.o -PRIVATE_DEPENDENCIES = RPC_NDR_DFS +PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC + +python_dfs_OBJ_FILES = librpc/gen_ndr/py_dfs.o [PYTHON::python_unixinfo] -OBJ_FILES = gen_ndr/py_unixinfo.o -PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO +PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC + +python_unixinfo_OBJ_FILES = librpc/gen_ndr/py_unixinfo.o [PYTHON::python_drsuapi] -OBJ_FILES = gen_ndr/py_drsuapi.o -PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI +PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC + +python_drsuapi_OBJ_FILES = librpc/gen_ndr/py_drsuapi.o [PYTHON::python_dcerpc_security] -OBJ_FILES = gen_ndr/py_security.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_dcerpc_security_OBJ_FILES = librpc/gen_ndr/py_security.o -- cgit From 08baea013b73607df0c86f24506912c7e6af6f7e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 02:25:16 +0200 Subject: Move SOVERSION, VERSION and PC_FILE out of smb_build but use make variables directly instead. (This used to be commit 9d0ae012b0b463278cd054d06788aa998acc2da2) --- source4/librpc/config.mk | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index abf7a434d0..92409da20e 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -1,21 +1,19 @@ ################################################ # Start SUBSYSTEM LIBNDR [LIBRARY::LIBNDR] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = ndr.pc PRIVATE_PROTO_HEADER = ndr/libndr_proto.h PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET \ LIBSAMBA-HOSTCONFIG + +LIBNDR_OBJ_FILES = $(addprefix librpc/ndr/, ndr.o ndr_basic.o ndr_string.o uuid.o) + +PC_FILES += librpc/ndr.pc +LIBNDR_VERSION = 0.0.1 +LIBNDR_SOVERSION = 0 + # End SUBSYSTEM LIBNDR ################################################ -LIBNDR_OBJ_FILES = \ - librpc/ndr/ndr.o \ - librpc/ndr/ndr_basic.o \ - librpc/ndr/ndr_string.o \ - librpc/ndr/uuid.o - PUBLIC_HEADERS += librpc/ndr/libndr.h ################################# @@ -430,10 +428,11 @@ RPC_NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo_c.o [LIBRARY::dcerpc_samr] PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR -PC_FILE = dcerpc_samr.pc -VERSION = 0.0.1 -SO_VERSION = 0 +PC_FILES += librpc/dcerpc_samr.pc + +dcerpc_samr_VERSION = 0.0.1 +dcerpc_samr_SOVERSION = 0 dcerpc_samr_OBJ_FILES = librpc/gen_ndr/ndr_samr_c.o [SUBSYSTEM::RPC_NDR_SPOOLSS] @@ -460,11 +459,12 @@ PUBLIC_HEADERS += librpc/gen_ndr/ndr_svcctl_c.h [LIBRARY::dcerpc_atsvc] PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC -PC_FILE = dcerpc_atsvc.pc -VERSION = 0.0.1 -SO_VERSION = 0 + +dcerpc_atsvc_VERSION = 0.0.1 +dcerpc_atsvc_SOVERSION = 0 dcerpc_atsvc_OBJ_FILES = librpc/gen_ndr/ndr_atsvc_c.o +PC_FILES += librpc/dcerpc_atsvc.pc PUBLIC_HEADERS += librpc/gen_ndr/ndr_atsvc_c.h @@ -573,9 +573,6 @@ PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h) ################################################ # Start SUBSYSTEM dcerpc [LIBRARY::dcerpc] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = dcerpc.pc PRIVATE_PROTO_HEADER = rpc/dcerpc_proto.h PRIVATE_DEPENDENCIES = \ samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \ @@ -588,6 +585,10 @@ PUBLIC_DEPENDENCIES = CREDENTIALS # End SUBSYSTEM dcerpc ################################################ +PC_FILES += librpc/dcerpc.pc +dcerpc_VERSION = 0.0.1 +dcerpc_SOVERSION = 0 + dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) -- cgit From b708a3d1e7f8d98bc6cedad8d405b1434d32a22e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 18:03:09 +0200 Subject: Split binding structure handling out into a separate file. For easier synchronisation with Samba 3. (This used to be commit b9cac469f3c869a26f415a6c551cf6e8fbb06ed6) --- source4/librpc/config.mk | 1 + source4/librpc/rpc/binding.c | 724 +++++++++++++++++++++++++++++++++++++++ source4/librpc/rpc/dcerpc_util.c | 695 ------------------------------------- 3 files changed, 725 insertions(+), 695 deletions(-) create mode 100644 source4/librpc/rpc/binding.c (limited to 'source4/librpc') diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 92409da20e..11a320a583 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -590,6 +590,7 @@ dcerpc_VERSION = 0.0.1 dcerpc_SOVERSION = 0 dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ + binding.o \ dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) diff --git a/source4/librpc/rpc/binding.c b/source4/librpc/rpc/binding.c new file mode 100644 index 0000000000..ae88dce1be --- /dev/null +++ b/source4/librpc/rpc/binding.c @@ -0,0 +1,724 @@ +/* + Unix SMB/CIFS implementation. + + dcerpc utility functions + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Jelmer Vernooij 2004 + Copyright (C) Andrew Bartlett 2005 + Copyright (C) Rafal Szczesniak 2006 + + 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 . +*/ + +#include "includes.h" +#include "lib/events/events.h" +#include "librpc/gen_ndr/ndr_epmapper_c.h" +#include "librpc/gen_ndr/ndr_dcerpc.h" +#include "librpc/gen_ndr/ndr_misc.h" + +#define MAX_PROTSEQ 10 + +static const struct { + const char *name; + enum dcerpc_transport_t transport; + int num_protocols; + enum epm_protocol protseq[MAX_PROTSEQ]; +} transports[] = { + { "ncacn_np", NCACN_NP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }}, + { "ncacn_ip_tcp", NCACN_IP_TCP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, + { "ncacn_http", NCACN_HTTP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, + { "ncadg_ip_udp", NCACN_IP_UDP, 3, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } }, + { "ncalrpc", NCALRPC, 2, + { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } }, + { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } }, + { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } }, + { "ncacn_at_dsp", NCACN_AT_DSP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } }, + { "ncadg_at_ddp", NCADG_AT_DDP, 3, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } }, + { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } }, + { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, }, + { "ncadg_ipx", NCADG_IPX, 2, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX }, + }, + { "ncacn_spx", NCACN_SPX, 3, + /* I guess some MS programmer confused the identifier for + * EPM_PROTOCOL_UUID (0x0D or 13) with the one for + * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/ + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID }, + }, +}; + +static const struct { + const char *name; + uint32_t flag; +} ncacn_options[] = { + {"sign", DCERPC_SIGN}, + {"seal", DCERPC_SEAL}, + {"connect", DCERPC_CONNECT}, + {"spnego", DCERPC_AUTH_SPNEGO}, + {"ntlm", DCERPC_AUTH_NTLM}, + {"krb5", DCERPC_AUTH_KRB5}, + {"validate", DCERPC_DEBUG_VALIDATE_BOTH}, + {"print", DCERPC_DEBUG_PRINT_BOTH}, + {"padcheck", DCERPC_DEBUG_PAD_CHECK}, + {"bigendian", DCERPC_PUSH_BIGENDIAN}, + {"smb2", DCERPC_SMB2} +}; + +const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) +{ + struct ndr_syntax_id syntax; + NTSTATUS status; + + switch(epm_floor->lhs.protocol) { + case EPM_PROTOCOL_UUID: + status = dcerpc_floor_get_lhs_data(epm_floor, &syntax); + if (NT_STATUS_IS_OK(status)) { + /* lhs is used: UUID */ + char *uuidstr; + + if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) { + return "NDR"; + } + + if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) { + return "NDR64"; + } + + uuidstr = GUID_string(mem_ctx, &syntax.uuid); + + return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version); + } else { /* IPX */ + return talloc_asprintf(mem_ctx, "IPX:%s", + data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown)); + } + + case EPM_PROTOCOL_NCACN: + return "RPC-C"; + + case EPM_PROTOCOL_NCADG: + return "RPC"; + + case EPM_PROTOCOL_NCALRPC: + return "NCALRPC"; + + case EPM_PROTOCOL_DNET_NSP: + return "DNET/NSP"; + + case EPM_PROTOCOL_IP: + return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr); + + case EPM_PROTOCOL_PIPE: + return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path); + + case EPM_PROTOCOL_SMB: + return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc); + + case EPM_PROTOCOL_UNIX_DS: + return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path); + + case EPM_PROTOCOL_NETBIOS: + return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name); + + case EPM_PROTOCOL_NETBEUI: + return "NETBeui"; + + case EPM_PROTOCOL_SPX: + return "SPX"; + + case EPM_PROTOCOL_NB_IPX: + return "NB_IPX"; + + case EPM_PROTOCOL_HTTP: + return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port); + + case EPM_PROTOCOL_TCP: + return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port); + + case EPM_PROTOCOL_UDP: + return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port); + + default: + return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol); + } +} + + +/* + form a binding string from a binding structure +*/ +_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b) +{ + char *s = talloc_strdup(mem_ctx, ""); + int i; + const char *t_name = NULL; + + if (b->transport != NCA_UNKNOWN) { + for (i=0;itransport) { + t_name = transports[i].name; + } + } + if (!t_name) { + return NULL; + } + } + + if (!GUID_all_zero(&b->object.uuid)) { + s = talloc_asprintf(s, "%s@", + GUID_string(mem_ctx, &b->object.uuid)); + } + + if (t_name != NULL) { + s = talloc_asprintf_append_buffer(s, "%s:", t_name); + if (s == NULL) { + return NULL; + } + } + + if (b->host) { + s = talloc_asprintf_append_buffer(s, "%s", b->host); + } + + if (!b->endpoint && !b->options && !b->flags) { + return s; + } + + s = talloc_asprintf_append_buffer(s, "["); + + if (b->endpoint) { + s = talloc_asprintf_append_buffer(s, "%s", b->endpoint); + } + + /* this is a *really* inefficent way of dealing with strings, + but this is rarely called and the strings are always short, + so I don't care */ + for (i=0;b->options && b->options[i];i++) { + s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]); + if (!s) return NULL; + } + + for (i=0;iflags & ncacn_options[i].flag) { + s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name); + if (!s) return NULL; + } + } + + s = talloc_asprintf_append_buffer(s, "]"); + + return s; +} + +/* + parse a binding string into a dcerpc_binding structure +*/ +_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out) +{ + struct dcerpc_binding *b; + char *options; + char *p; + int i, j, comma_count; + + b = talloc(mem_ctx, struct dcerpc_binding); + if (!b) { + return NT_STATUS_NO_MEMORY; + } + + p = strchr(s, '@'); + + if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */ + NTSTATUS status; + + status = GUID_from_string(s, &b->object.uuid); + + if (NT_STATUS_IS_ERR(status)) { + DEBUG(0, ("Failed parsing UUID\n")); + return status; + } + + s = p + 1; + } else { + ZERO_STRUCT(b->object); + } + + b->object.if_version = 0; + + p = strchr(s, ':'); + + if (p == NULL) { + b->transport = NCA_UNKNOWN; + } else { + char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); + if (!type) { + return NT_STATUS_NO_MEMORY; + } + + for (i=0;itransport = transports[i].transport; + break; + } + } + + if (i==ARRAY_SIZE(transports)) { + DEBUG(0,("Unknown dcerpc transport '%s'\n", type)); + return NT_STATUS_INVALID_PARAMETER; + } + + talloc_free(type); + + s = p+1; + } + + p = strchr(s, '['); + if (p) { + b->host = talloc_strndup(b, s, PTR_DIFF(p, s)); + options = talloc_strdup(mem_ctx, p+1); + if (options[strlen(options)-1] != ']') { + return NT_STATUS_INVALID_PARAMETER; + } + options[strlen(options)-1] = 0; + } else { + b->host = talloc_strdup(b, s); + options = NULL; + } + if (!b->host) { + return NT_STATUS_NO_MEMORY; + } + + b->target_hostname = b->host; + + b->options = NULL; + b->flags = 0; + b->assoc_group_id = 0; + b->endpoint = NULL; + + if (!options) { + *b_out = b; + return NT_STATUS_OK; + } + + comma_count = count_chars(options, ','); + + b->options = talloc_array(b, const char *, comma_count+2); + if (!b->options) { + return NT_STATUS_NO_MEMORY; + } + + for (i=0; (p = strchr(options, ',')); i++) { + b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options)); + if (!b->options[i]) { + return NT_STATUS_NO_MEMORY; + } + options = p+1; + } + b->options[i] = options; + b->options[i+1] = NULL; + + /* some options are pre-parsed for convenience */ + for (i=0;b->options[i];i++) { + for (j=0;joptions[i]) == 0) { + int k; + b->flags |= ncacn_options[j].flag; + for (k=i;b->options[k];k++) { + b->options[k] = b->options[k+1]; + } + i--; + break; + } + } + } + + if (b->options[0]) { + /* Endpoint is first option */ + b->endpoint = b->options[0]; + if (strlen(b->endpoint) == 0) b->endpoint = NULL; + + for (i=0;b->options[i];i++) { + b->options[i] = b->options[i+1]; + } + } + + if (b->options[0] == NULL) + b->options = NULL; + + *b_out = b; + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax) +{ + TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data"); + struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL); + enum ndr_err_code ndr_err; + uint16_t if_version=0; + + ndr->flags |= LIBNDR_FLAG_NOALIGN; + + ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(mem_ctx); + return ndr_map_error2ntstatus(ndr_err); + } + + ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(mem_ctx); + return ndr_map_error2ntstatus(ndr_err); + } + + syntax->if_version = if_version; + + talloc_free(mem_ctx); + + return NT_STATUS_OK; +} + +static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax) +{ + struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL); + + ndr->flags |= LIBNDR_FLAG_NOALIGN; + + ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); + ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version); + + return ndr_push_blob(ndr); +} + +const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) +{ + switch (epm_floor->lhs.protocol) { + case EPM_PROTOCOL_TCP: + if (epm_floor->rhs.tcp.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port); + + case EPM_PROTOCOL_UDP: + if (epm_floor->rhs.udp.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port); + + case EPM_PROTOCOL_HTTP: + if (epm_floor->rhs.http.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port); + + case EPM_PROTOCOL_IP: + return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr); + + case EPM_PROTOCOL_NCACN: + return NULL; + + case EPM_PROTOCOL_NCADG: + return NULL; + + case EPM_PROTOCOL_SMB: + if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc); + + case EPM_PROTOCOL_PIPE: + if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path); + + case EPM_PROTOCOL_NETBIOS: + if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name); + + case EPM_PROTOCOL_NCALRPC: + return NULL; + + case EPM_PROTOCOL_VINES_SPP: + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port); + + case EPM_PROTOCOL_VINES_IPC: + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port); + + case EPM_PROTOCOL_STREETTALK: + return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk); + + case EPM_PROTOCOL_UNIX_DS: + if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path); + + case EPM_PROTOCOL_NULL: + return NULL; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); + break; + } + + return NULL; +} + +static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, + struct epm_floor *epm_floor, + const char *data) +{ + switch (epm_floor->lhs.protocol) { + case EPM_PROTOCOL_TCP: + epm_floor->rhs.tcp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_UDP: + epm_floor->rhs.udp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_HTTP: + epm_floor->rhs.http.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_IP: + epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCACN: + epm_floor->rhs.ncacn.minor_version = 0; + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCADG: + epm_floor->rhs.ncadg.minor_version = 0; + return NT_STATUS_OK; + + case EPM_PROTOCOL_SMB: + epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc); + return NT_STATUS_OK; + + case EPM_PROTOCOL_PIPE: + epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NETBIOS: + epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCALRPC: + return NT_STATUS_OK; + + case EPM_PROTOCOL_VINES_SPP: + epm_floor->rhs.vines_spp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_VINES_IPC: + epm_floor->rhs.vines_ipc.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_STREETTALK: + epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk); + return NT_STATUS_OK; + + case EPM_PROTOCOL_UNIX_DS: + epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NULL: + return NT_STATUS_OK; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); + break; + } + + return NT_STATUS_NOT_SUPPORTED; +} + +enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot) +{ + int i; + + /* Find a transport that has 'prot' as 4th protocol */ + for (i=0;i= 2 && + transports[i].protseq[1] == prot) { + return transports[i].transport; + } + } + + /* Unknown transport */ + return (unsigned int)-1; +} + +_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower) +{ + int i; + + /* Find a transport that matches this tower */ + for (i=0;inum_floors - 2) { + continue; + } + + for (j = 0; j < transports[i].num_protocols; j++) { + if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) { + break; + } + } + + if (j == transports[i].num_protocols) { + return transports[i].transport; + } + } + + /* Unknown transport */ + return (unsigned int)-1; +} + +_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, + struct epm_tower *tower, + struct dcerpc_binding **b_out) +{ + NTSTATUS status; + struct dcerpc_binding *binding; + + binding = talloc(mem_ctx, struct dcerpc_binding); + NT_STATUS_HAVE_NO_MEMORY(binding); + + ZERO_STRUCT(binding->object); + binding->options = NULL; + binding->host = NULL; + binding->target_hostname = NULL; + binding->flags = 0; + binding->assoc_group_id = 0; + + binding->transport = dcerpc_transport_by_tower(tower); + + if (binding->transport == (unsigned int)-1) { + return NT_STATUS_NOT_SUPPORTED; + } + + if (tower->num_floors < 1) { + return NT_STATUS_OK; + } + + /* Set object uuid */ + status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status))); + return status; + } + + /* Ignore floor 1, it contains the NDR version info */ + + binding->options = NULL; + + /* Set endpoint */ + if (tower->num_floors >= 4) { + binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]); + } else { + binding->endpoint = NULL; + } + + /* Set network address */ + if (tower->num_floors >= 5) { + binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]); + NT_STATUS_HAVE_NO_MEMORY(binding->host); + binding->target_hostname = binding->host; + } + *b_out = binding; + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) +{ + const enum epm_protocol *protseq = NULL; + int num_protocols = -1, i; + NTSTATUS status; + + /* Find transport */ + for (i=0;itransport) { + protseq = transports[i].protseq; + num_protocols = transports[i].num_protocols; + break; + } + } + + if (num_protocols == -1) { + DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport)); + return NT_STATUS_UNSUCCESSFUL; + } + + tower->num_floors = 2 + num_protocols; + tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors); + + /* Floor 0 */ + tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; + + tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object); + + tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); + + /* Floor 1 */ + tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; + + tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, + &ndr_transfer_syntax); + + tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); + + /* Floor 2 to num_protocols */ + for (i = 0; i < num_protocols; i++) { + tower->floors[2 + i].lhs.protocol = protseq[i]; + tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0); + ZERO_STRUCT(tower->floors[2 + i].rhs); + dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], ""); + } + + /* The 4th floor contains the endpoint */ + if (num_protocols >= 2 && binding->endpoint) { + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + } + + /* The 5th contains the network address */ + if (num_protocols >= 3 && binding->host) { + if (is_ipaddress(binding->host)) { + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], + binding->host); + } else { + /* note that we don't attempt to resolve the + name here - when we get a hostname here we + are in the client code, and want to put in + a wildcard all-zeros IP for the server to + fill in */ + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], + "0.0.0.0"); + } + if (NT_STATUS_IS_ERR(status)) { + return status; + } + } + + return NT_STATUS_OK; +} diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 3b8768ccc2..469c83788c 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -97,701 +97,6 @@ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -#define MAX_PROTSEQ 10 - -static const struct { - const char *name; - enum dcerpc_transport_t transport; - int num_protocols; - enum epm_protocol protseq[MAX_PROTSEQ]; -} transports[] = { - { "ncacn_np", NCACN_NP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }}, - { "ncacn_ip_tcp", NCACN_IP_TCP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, - { "ncacn_http", NCACN_HTTP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, - { "ncadg_ip_udp", NCACN_IP_UDP, 3, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } }, - { "ncalrpc", NCALRPC, 2, - { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } }, - { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } }, - { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } }, - { "ncacn_at_dsp", NCACN_AT_DSP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } }, - { "ncadg_at_ddp", NCADG_AT_DDP, 3, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } }, - { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } }, - { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, }, - { "ncadg_ipx", NCADG_IPX, 2, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX }, - }, - { "ncacn_spx", NCACN_SPX, 3, - /* I guess some MS programmer confused the identifier for - * EPM_PROTOCOL_UUID (0x0D or 13) with the one for - * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/ - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID }, - }, -}; - -static const struct { - const char *name; - uint32_t flag; -} ncacn_options[] = { - {"sign", DCERPC_SIGN}, - {"seal", DCERPC_SEAL}, - {"connect", DCERPC_CONNECT}, - {"spnego", DCERPC_AUTH_SPNEGO}, - {"ntlm", DCERPC_AUTH_NTLM}, - {"krb5", DCERPC_AUTH_KRB5}, - {"validate", DCERPC_DEBUG_VALIDATE_BOTH}, - {"print", DCERPC_DEBUG_PRINT_BOTH}, - {"padcheck", DCERPC_DEBUG_PAD_CHECK}, - {"bigendian", DCERPC_PUSH_BIGENDIAN}, - {"smb2", DCERPC_SMB2} -}; - -const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) -{ - struct ndr_syntax_id syntax; - NTSTATUS status; - - switch(epm_floor->lhs.protocol) { - case EPM_PROTOCOL_UUID: - status = dcerpc_floor_get_lhs_data(epm_floor, &syntax); - if (NT_STATUS_IS_OK(status)) { - /* lhs is used: UUID */ - char *uuidstr; - - if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) { - return "NDR"; - } - - if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) { - return "NDR64"; - } - - uuidstr = GUID_string(mem_ctx, &syntax.uuid); - - return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version); - } else { /* IPX */ - return talloc_asprintf(mem_ctx, "IPX:%s", - data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown)); - } - - case EPM_PROTOCOL_NCACN: - return "RPC-C"; - - case EPM_PROTOCOL_NCADG: - return "RPC"; - - case EPM_PROTOCOL_NCALRPC: - return "NCALRPC"; - - case EPM_PROTOCOL_DNET_NSP: - return "DNET/NSP"; - - case EPM_PROTOCOL_IP: - return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr); - - case EPM_PROTOCOL_PIPE: - return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path); - - case EPM_PROTOCOL_SMB: - return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc); - - case EPM_PROTOCOL_UNIX_DS: - return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path); - - case EPM_PROTOCOL_NETBIOS: - return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name); - - case EPM_PROTOCOL_NETBEUI: - return "NETBeui"; - - case EPM_PROTOCOL_SPX: - return "SPX"; - - case EPM_PROTOCOL_NB_IPX: - return "NB_IPX"; - - case EPM_PROTOCOL_HTTP: - return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port); - - case EPM_PROTOCOL_TCP: - return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port); - - case EPM_PROTOCOL_UDP: - return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port); - - default: - return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol); - } -} - - -/* - form a binding string from a binding structure -*/ -_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b) -{ - char *s = talloc_strdup(mem_ctx, ""); - int i; - const char *t_name = NULL; - - if (b->transport != NCA_UNKNOWN) { - for (i=0;itransport) { - t_name = transports[i].name; - } - } - if (!t_name) { - return NULL; - } - } - - if (!GUID_all_zero(&b->object.uuid)) { - s = talloc_asprintf(s, "%s@", - GUID_string(mem_ctx, &b->object.uuid)); - } - - if (t_name != NULL) { - s = talloc_asprintf_append_buffer(s, "%s:", t_name); - if (s == NULL) { - return NULL; - } - } - - if (b->host) { - s = talloc_asprintf_append_buffer(s, "%s", b->host); - } - - if (!b->endpoint && !b->options && !b->flags) { - return s; - } - - s = talloc_asprintf_append_buffer(s, "["); - - if (b->endpoint) { - s = talloc_asprintf_append_buffer(s, "%s", b->endpoint); - } - - /* this is a *really* inefficent way of dealing with strings, - but this is rarely called and the strings are always short, - so I don't care */ - for (i=0;b->options && b->options[i];i++) { - s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]); - if (!s) return NULL; - } - - for (i=0;iflags & ncacn_options[i].flag) { - s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name); - if (!s) return NULL; - } - } - - s = talloc_asprintf_append_buffer(s, "]"); - - return s; -} - -/* - parse a binding string into a dcerpc_binding structure -*/ -_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out) -{ - struct dcerpc_binding *b; - char *options; - char *p; - int i, j, comma_count; - - b = talloc(mem_ctx, struct dcerpc_binding); - if (!b) { - return NT_STATUS_NO_MEMORY; - } - - p = strchr(s, '@'); - - if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */ - NTSTATUS status; - - status = GUID_from_string(s, &b->object.uuid); - - if (NT_STATUS_IS_ERR(status)) { - DEBUG(0, ("Failed parsing UUID\n")); - return status; - } - - s = p + 1; - } else { - ZERO_STRUCT(b->object); - } - - b->object.if_version = 0; - - p = strchr(s, ':'); - - if (p == NULL) { - b->transport = NCA_UNKNOWN; - } else { - char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); - if (!type) { - return NT_STATUS_NO_MEMORY; - } - - for (i=0;itransport = transports[i].transport; - break; - } - } - - if (i==ARRAY_SIZE(transports)) { - DEBUG(0,("Unknown dcerpc transport '%s'\n", type)); - return NT_STATUS_INVALID_PARAMETER; - } - - talloc_free(type); - - s = p+1; - } - - p = strchr(s, '['); - if (p) { - b->host = talloc_strndup(b, s, PTR_DIFF(p, s)); - options = talloc_strdup(mem_ctx, p+1); - if (options[strlen(options)-1] != ']') { - return NT_STATUS_INVALID_PARAMETER; - } - options[strlen(options)-1] = 0; - } else { - b->host = talloc_strdup(b, s); - options = NULL; - } - if (!b->host) { - return NT_STATUS_NO_MEMORY; - } - - b->target_hostname = b->host; - - b->options = NULL; - b->flags = 0; - b->assoc_group_id = 0; - b->endpoint = NULL; - - if (!options) { - *b_out = b; - return NT_STATUS_OK; - } - - comma_count = count_chars(options, ','); - - b->options = talloc_array(b, const char *, comma_count+2); - if (!b->options) { - return NT_STATUS_NO_MEMORY; - } - - for (i=0; (p = strchr(options, ',')); i++) { - b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options)); - if (!b->options[i]) { - return NT_STATUS_NO_MEMORY; - } - options = p+1; - } - b->options[i] = options; - b->options[i+1] = NULL; - - /* some options are pre-parsed for convenience */ - for (i=0;b->options[i];i++) { - for (j=0;joptions[i]) == 0) { - int k; - b->flags |= ncacn_options[j].flag; - for (k=i;b->options[k];k++) { - b->options[k] = b->options[k+1]; - } - i--; - break; - } - } - } - - if (b->options[0]) { - /* Endpoint is first option */ - b->endpoint = b->options[0]; - if (strlen(b->endpoint) == 0) b->endpoint = NULL; - - for (i=0;b->options[i];i++) { - b->options[i] = b->options[i+1]; - } - } - - if (b->options[0] == NULL) - b->options = NULL; - - *b_out = b; - return NT_STATUS_OK; -} - -_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax) -{ - TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data"); - struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL); - enum ndr_err_code ndr_err; - uint16_t if_version=0; - - ndr->flags |= LIBNDR_FLAG_NOALIGN; - - ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(mem_ctx); - return ndr_map_error2ntstatus(ndr_err); - } - - ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(mem_ctx); - return ndr_map_error2ntstatus(ndr_err); - } - - syntax->if_version = if_version; - - talloc_free(mem_ctx); - - return NT_STATUS_OK; -} - -static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax) -{ - struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL); - - ndr->flags |= LIBNDR_FLAG_NOALIGN; - - ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); - ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version); - - return ndr_push_blob(ndr); -} - -const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) -{ - switch (epm_floor->lhs.protocol) { - case EPM_PROTOCOL_TCP: - if (epm_floor->rhs.tcp.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port); - - case EPM_PROTOCOL_UDP: - if (epm_floor->rhs.udp.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port); - - case EPM_PROTOCOL_HTTP: - if (epm_floor->rhs.http.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port); - - case EPM_PROTOCOL_IP: - return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr); - - case EPM_PROTOCOL_NCACN: - return NULL; - - case EPM_PROTOCOL_NCADG: - return NULL; - - case EPM_PROTOCOL_SMB: - if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc); - - case EPM_PROTOCOL_PIPE: - if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path); - - case EPM_PROTOCOL_NETBIOS: - if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name); - - case EPM_PROTOCOL_NCALRPC: - return NULL; - - case EPM_PROTOCOL_VINES_SPP: - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port); - - case EPM_PROTOCOL_VINES_IPC: - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port); - - case EPM_PROTOCOL_STREETTALK: - return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk); - - case EPM_PROTOCOL_UNIX_DS: - if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path); - - case EPM_PROTOCOL_NULL: - return NULL; - - default: - DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); - break; - } - - return NULL; -} - -static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, - struct epm_floor *epm_floor, - const char *data) -{ - switch (epm_floor->lhs.protocol) { - case EPM_PROTOCOL_TCP: - epm_floor->rhs.tcp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_UDP: - epm_floor->rhs.udp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_HTTP: - epm_floor->rhs.http.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_IP: - epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCACN: - epm_floor->rhs.ncacn.minor_version = 0; - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCADG: - epm_floor->rhs.ncadg.minor_version = 0; - return NT_STATUS_OK; - - case EPM_PROTOCOL_SMB: - epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc); - return NT_STATUS_OK; - - case EPM_PROTOCOL_PIPE: - epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NETBIOS: - epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCALRPC: - return NT_STATUS_OK; - - case EPM_PROTOCOL_VINES_SPP: - epm_floor->rhs.vines_spp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_VINES_IPC: - epm_floor->rhs.vines_ipc.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_STREETTALK: - epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk); - return NT_STATUS_OK; - - case EPM_PROTOCOL_UNIX_DS: - epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NULL: - return NT_STATUS_OK; - - default: - DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); - break; - } - - return NT_STATUS_NOT_SUPPORTED; -} - -enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot) -{ - int i; - - /* Find a transport that has 'prot' as 4th protocol */ - for (i=0;i= 2 && - transports[i].protseq[1] == prot) { - return transports[i].transport; - } - } - - /* Unknown transport */ - return (unsigned int)-1; -} - -_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower) -{ - int i; - - /* Find a transport that matches this tower */ - for (i=0;inum_floors - 2) { - continue; - } - - for (j = 0; j < transports[i].num_protocols; j++) { - if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) { - break; - } - } - - if (j == transports[i].num_protocols) { - return transports[i].transport; - } - } - - /* Unknown transport */ - return (unsigned int)-1; -} - -_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, - struct epm_tower *tower, - struct dcerpc_binding **b_out) -{ - NTSTATUS status; - struct dcerpc_binding *binding; - - binding = talloc(mem_ctx, struct dcerpc_binding); - NT_STATUS_HAVE_NO_MEMORY(binding); - - ZERO_STRUCT(binding->object); - binding->options = NULL; - binding->host = NULL; - binding->target_hostname = NULL; - binding->flags = 0; - binding->assoc_group_id = 0; - - binding->transport = dcerpc_transport_by_tower(tower); - - if (binding->transport == (unsigned int)-1) { - return NT_STATUS_NOT_SUPPORTED; - } - - if (tower->num_floors < 1) { - return NT_STATUS_OK; - } - - /* Set object uuid */ - status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object); - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status))); - return status; - } - - /* Ignore floor 1, it contains the NDR version info */ - - binding->options = NULL; - - /* Set endpoint */ - if (tower->num_floors >= 4) { - binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]); - } else { - binding->endpoint = NULL; - } - - /* Set network address */ - if (tower->num_floors >= 5) { - binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]); - NT_STATUS_HAVE_NO_MEMORY(binding->host); - binding->target_hostname = binding->host; - } - *b_out = binding; - return NT_STATUS_OK; -} - -_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) -{ - const enum epm_protocol *protseq = NULL; - int num_protocols = -1, i; - NTSTATUS status; - - /* Find transport */ - for (i=0;itransport) { - protseq = transports[i].protseq; - num_protocols = transports[i].num_protocols; - break; - } - } - - if (num_protocols == -1) { - DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport)); - return NT_STATUS_UNSUCCESSFUL; - } - - tower->num_floors = 2 + num_protocols; - tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors); - - /* Floor 0 */ - tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; - - tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object); - - tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); - - /* Floor 1 */ - tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; - - tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, - &ndr_transfer_syntax); - - tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); - - /* Floor 2 to num_protocols */ - for (i = 0; i < num_protocols; i++) { - tower->floors[2 + i].lhs.protocol = protseq[i]; - tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0); - ZERO_STRUCT(tower->floors[2 + i].rhs); - dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], ""); - } - - /* The 4th floor contains the endpoint */ - if (num_protocols >= 2 && binding->endpoint) { - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - } - - /* The 5th contains the network address */ - if (num_protocols >= 3 && binding->host) { - if (is_ipaddress(binding->host)) { - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], - binding->host); - } else { - /* note that we don't attempt to resolve the - name here - when we get a hostname here we - are in the client code, and want to put in - a wildcard all-zeros IP for the server to - fill in */ - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], - "0.0.0.0"); - } - if (NT_STATUS_IS_ERR(status)) { - return status; - } - } - - return NT_STATUS_OK; -} - struct epm_map_binding_state { struct dcerpc_binding *binding; -- cgit