diff options
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/config.mk | 46 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 19 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 8 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 38 |
4 files changed, 84 insertions, 27 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 8a845a186a..2588590275 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -32,10 +32,50 @@ REQUIRED_SUBSYSTEMS = SOCKET ################################################ # Start SUBSYSTEM LIBNDR_GEN [SUBSYSTEM::LIBNDR_GEN] +INIT_FUNCTION = \ + dcerpc_audiosrv_init \ + dcerpc_dcerpc_init \ + dcerpc_echo_init \ + dcerpc_exchange_init \ + dcerpc_dsbackup_init \ + dcerpc_efs_init \ + dcerpc_misc_init \ + dcerpc_lsa_init \ + dcerpc_lsads_init \ + dcerpc_dfs_init \ + dcerpc_drsuapi_init \ + dcerpc_policyagent_init \ + dcerpc_samr_init \ + dcerpc_spoolss_init \ + dcerpc_wkssvc_init \ + dcerpc_srvsvc_init \ + dcerpc_svcctl_init \ + dcerpc_atsvc_init \ + dcerpc_eventlog_init \ + dcerpc_epmapper_init \ + dcerpc_dbgidl_init \ + dcerpc_dssetup_init \ + dcerpc_msgsvc_init \ + dcerpc_wins_init \ + dcerpc_winreg_init \ + dcerpc_mgmt_init \ + dcerpc_protected_storage_init \ + dcerpc_dcom_init \ + dcerpc_oxidresolver_init \ + dcerpc_remact_init \ + dcerpc_wzcsvc_init \ + dcerpc_browser_init \ + dcerpc_w32time_init \ + dcerpc_scerpc_init \ + dcerpc_ntsvcs_init \ + dcerpc_netlogon_init \ + dcerpc_trkwks_init \ + dcerpc_keysvc_init \ + dcerpc_krb5pac_init \ + dcerpc_xattr_init \ + dcerpc_schannel_init + NOPROTO = YES -INIT_FUNCTION = librpc_init -INIT_OBJ_FILES = \ - librpc/gen_ndr/tables.o ADD_OBJ_FILES = \ librpc/gen_ndr/ndr_audiosrv.o \ librpc/gen_ndr/ndr_dcerpc.o \ diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index f4b10f6b52..2427a22e59 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -24,12 +24,23 @@ #include "dlinklist.h" #include "librpc/gen_ndr/ndr_epmapper.h" -NTSTATUS librpc_init(void) +struct dcerpc_interface_list *dcerpc_pipes = NULL; + +NTSTATUS librpc_register_interface (const struct dcerpc_interface_table *interface) { - /* FIXME: Register module registration function here */ - return NT_STATUS_OK; + struct dcerpc_interface_list *l = talloc_p(NULL, struct dcerpc_interface_list); + + if (idl_iface_by_name (interface->name) != NULL) { + DEBUG(0, ("Attempt to register interface %s twice\n", interface->name)); + return NT_STATUS_OBJECT_NAME_COLLISION; + } + l->table = interface; + + DLIST_ADD(dcerpc_pipes, l); + + return NT_STATUS_OK; } - + /* initialise a dcerpc pipe. */ struct dcerpc_pipe *dcerpc_pipe_init(void) { diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 31444e9dba..47f13e643d 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -141,6 +141,14 @@ struct dcerpc_interface_table { const struct dcerpc_endpoint_list *endpoints; }; +struct dcerpc_interface_list +{ + struct dcerpc_interface_list *prev, *next; + const struct dcerpc_interface_table *table; +}; + +extern struct dcerpc_interface_list *dcerpc_pipes; + /* this describes a binding to a particular transport/pipe */ struct dcerpc_binding { diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index c31cf2791b..5c824cec99 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -24,18 +24,17 @@ #include "includes.h" #include "system/network.h" #include "librpc/gen_ndr/ndr_epmapper.h" -#include "librpc/gen_ndr/tables.h" /* find the pipe name for a local IDL interface */ const char *idl_pipe_name(const char *uuid, uint32_t if_version) { - int i; - for (i=0;dcerpc_pipes[i];i++) { - if (strcasecmp(dcerpc_pipes[i]->uuid, uuid) == 0 && - dcerpc_pipes[i]->if_version == if_version) { - return dcerpc_pipes[i]->name; + struct dcerpc_interface_list *l; + for (l=dcerpc_pipes;l;l=l->next) { + if (strcasecmp(l->table->uuid, uuid) == 0 && + l->table->if_version == if_version) { + return l->table->name; } } return "UNKNOWN"; @@ -46,11 +45,11 @@ const char *idl_pipe_name(const char *uuid, uint32_t if_version) */ int idl_num_calls(const char *uuid, uint32_t if_version) { - int i; - for (i=0;dcerpc_pipes[i];i++) { - if (strcasecmp(dcerpc_pipes[i]->uuid, uuid) == 0 && - dcerpc_pipes[i]->if_version == if_version) { - return dcerpc_pipes[i]->num_calls; + struct dcerpc_interface_list *l; + for (l=dcerpc_pipes;l;l=l->next){ + if (strcasecmp(l->table->uuid, uuid) == 0 && + l->table->if_version == if_version) { + return l->table->num_calls; } } return -1; @@ -62,10 +61,10 @@ int idl_num_calls(const char *uuid, uint32_t if_version) */ const struct dcerpc_interface_table *idl_iface_by_name(const char *name) { - int i; - for (i=0;dcerpc_pipes[i];i++) { - if (strcasecmp(dcerpc_pipes[i]->name, name) == 0) { - return dcerpc_pipes[i]; + struct dcerpc_interface_list *l; + for (l=dcerpc_pipes;l;l=l->next) { + if (strcasecmp(l->table->name, name) == 0) { + return l->table; } } return NULL; @@ -76,17 +75,16 @@ const struct dcerpc_interface_table *idl_iface_by_name(const char *name) */ const struct dcerpc_interface_table *idl_iface_by_uuid(const char *uuid) { - int i; - for (i=0;dcerpc_pipes[i];i++) { - if (strcasecmp(dcerpc_pipes[i]->uuid, uuid) == 0) { - return dcerpc_pipes[i]; + struct dcerpc_interface_list *l; + for (l=dcerpc_pipes;l;l=l->next) { + if (strcasecmp(l->table->uuid, uuid) == 0) { + return l->table; } } return NULL; } - /* push a dcerpc_packet into a blob, potentially with auth info */ |