From 6ec4306f8c3fed7ec5b5bd164c5829b2661589b7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 16 Apr 2011 15:41:50 +1000 Subject: auth/kerberos: Create common helper to get the verified PAC from GSSAPI This only works for Heimdal and MIT Krb5 1.8, other versions will get an ACCESS_DEINED error. We no longer manually verify any details of the PAC in Samba for GSSAPI logins, as we never had the information to do it properly, and it is better to have the GSSAPI library handle it. Andrew Bartlett --- source3/rpc_server/dcesrv_gssapi.c | 62 +++++--------------------------------- 1 file changed, 8 insertions(+), 54 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dcesrv_gssapi.c b/source3/rpc_server/dcesrv_gssapi.c index ec024596332..b63f4f129e7 100644 --- a/source3/rpc_server/dcesrv_gssapi.c +++ b/source3/rpc_server/dcesrv_gssapi.c @@ -23,6 +23,7 @@ #include "../librpc/gen_ndr/ndr_krb5pac.h" #include "librpc/crypto/gse.h" #include "auth.h" +#include "libcli/auth/krb5_wrap.h" NTSTATUS gssapi_server_auth_start(TALLOC_CTX *mem_ctx, bool do_sign, @@ -105,14 +106,9 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, struct auth_serversupplied_info **server_info) { TALLOC_CTX *tmp_ctx; - DATA_BLOB auth_data; - time_t tgs_authtime; - NTTIME tgs_authtime_nttime; - DATA_BLOB pac; + DATA_BLOB pac_blob; struct PAC_DATA *pac_data; - struct PAC_LOGON_NAME *logon_name = NULL; struct PAC_LOGON_INFO *logon_info = NULL; - enum ndr_err_code ndr_err; unsigned int i; bool is_mapped; bool is_guest; @@ -122,14 +118,13 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, char *username; struct passwd *pw; NTSTATUS status; - bool bret; tmp_ctx = talloc_new(mem_ctx); if (!tmp_ctx) { return NT_STATUS_NO_MEMORY; } - status = gse_get_authz_data(gse_ctx, tmp_ctx, &auth_data); + status = gse_get_pac_blob(gse_ctx, tmp_ctx, &pac_blob); if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { /* TODO: Fetch user by principal name ? */ status = NT_STATUS_ACCESS_DENIED; @@ -139,37 +134,18 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, goto done; } - bret = unwrap_pac(tmp_ctx, &auth_data, &pac); - if (!bret) { - DEBUG(1, ("Failed to unwrap PAC\n")); - status = NT_STATUS_ACCESS_DENIED; - goto done; - } - - status = gse_get_client_name(gse_ctx, tmp_ctx, &princ_name); + status = kerberos_decode_pac(tmp_ctx, + pac_blob, + NULL, NULL, NULL, NULL, 0, &pac_data); + data_blob_free(&pac_blob); if (!NT_STATUS_IS_OK(status)) { goto done; } - status = gse_get_authtime(gse_ctx, &tgs_authtime); + status = gse_get_client_name(gse_ctx, tmp_ctx, &princ_name); if (!NT_STATUS_IS_OK(status)) { goto done; } - unix_to_nt_time(&tgs_authtime_nttime, tgs_authtime); - - pac_data = talloc_zero(tmp_ctx, struct PAC_DATA); - if (!pac_data) { - status = NT_STATUS_NO_MEMORY; - goto done; - } - - ndr_err = ndr_pull_struct_blob(&pac, pac_data, pac_data, - (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - DEBUG(1, ("Failed to parse the PAC for %s\n", princ_name)); - status = ndr_map_error2ntstatus(ndr_err); - goto done; - } /* get logon name and logon info */ for (i = 0; i < pac_data->num_buffers; i++) { @@ -182,9 +158,6 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, } logon_info = data_buf->info->logon_info.info; break; - case PAC_TYPE_LOGON_NAME: - logon_name = &data_buf->info->logon_name; - break; default: break; } @@ -194,25 +167,6 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, status = NT_STATUS_NOT_FOUND; goto done; } - if (!logon_name) { - DEBUG(1, ("Invalid PAC data, missing logon info!\n")); - status = NT_STATUS_NOT_FOUND; - goto done; - } - - /* check time */ - if (tgs_authtime_nttime != logon_name->logon_time) { - DEBUG(1, ("Logon time mismatch between ticket and PAC!\n" - "PAC Time = %s | Ticket Time = %s\n", - nt_time_string(tmp_ctx, logon_name->logon_time), - nt_time_string(tmp_ctx, tgs_authtime_nttime))); - status = NT_STATUS_ACCESS_DENIED; - goto done; - } - - /* TODO: Should we check princ_name against account_name in - * logon_name ? Are they supposed to be identical, or can an - * account_name be different from the UPN ? */ status = get_user_from_kerberos_info(tmp_ctx, client_id->name, princ_name, logon_info, -- cgit From 91ebf22fa8aa5ecd9b4508b5b2c448e5edc3d151 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 27 Apr 2011 15:37:59 +1000 Subject: s3-rpc_server Fix compile without kerberos Autobuild-User: Andrew Bartlett Autobuild-Date: Wed Apr 27 23:08:48 CEST 2011 on sn-devel-104 --- source3/rpc_server/dcesrv_gssapi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dcesrv_gssapi.c b/source3/rpc_server/dcesrv_gssapi.c index b63f4f129e7..534e8a41896 100644 --- a/source3/rpc_server/dcesrv_gssapi.c +++ b/source3/rpc_server/dcesrv_gssapi.c @@ -23,8 +23,9 @@ #include "../librpc/gen_ndr/ndr_krb5pac.h" #include "librpc/crypto/gse.h" #include "auth.h" +#ifdef HAVE_KRB5 #include "libcli/auth/krb5_wrap.h" - +#endif NTSTATUS gssapi_server_auth_start(TALLOC_CTX *mem_ctx, bool do_sign, bool do_seal, @@ -107,7 +108,7 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, { TALLOC_CTX *tmp_ctx; DATA_BLOB pac_blob; - struct PAC_DATA *pac_data; + struct PAC_DATA *pac_data = NULL; struct PAC_LOGON_INFO *logon_info = NULL; unsigned int i; bool is_mapped; @@ -134,9 +135,13 @@ NTSTATUS gssapi_server_get_user_info(struct gse_context *gse_ctx, goto done; } +#ifdef HAVE_KRB5 status = kerberos_decode_pac(tmp_ctx, pac_blob, NULL, NULL, NULL, NULL, 0, &pac_data); +#else + status = NT_STATUS_ACCESS_DENIED; +#endif data_blob_free(&pac_blob); if (!NT_STATUS_IS_OK(status)) { goto done; -- cgit From bb520dceac7e55ba63826edd9a12aba7c877db38 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 28 Apr 2011 16:23:53 +1000 Subject: build: Fix kerberos build issues in top level build --- source3/rpc_server/wscript_build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index 346d770385e..eb24f06268e 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -33,7 +33,8 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', source='rpc_server.c') bld.SAMBA3_SUBSYSTEM('RPC_CRYPTO', - source='dcesrv_ntlmssp.c dcesrv_gssapi.c dcesrv_spnego.c') + source='dcesrv_ntlmssp.c dcesrv_gssapi.c dcesrv_spnego.c', + deps = 'KRB5_PAC') bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER', source='srv_pipe_register.c') -- cgit From 12476223c6aa7473c55bcf529639eefce8450680 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Apr 2011 17:26:40 +0200 Subject: s3-tsocket: only include ../lib/tsocket/tsocket.h where needed. Guenther --- source3/rpc_server/rpc_ncacn_np.c | 1 + source3/rpc_server/srv_pipe_hnd.c | 1 + 2 files changed, 2 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index e89a366f9e9..bd751788578 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -31,6 +31,7 @@ #include "../auth/auth_sam_reply.h" #include "auth.h" #include "ntdomain.h" +#include "../lib/tsocket/tsocket.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 52525987269..11689672d6a 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -29,6 +29,7 @@ #include "rpc_dce.h" #include "rpc_server/rpc_ncacn_np.h" #include "ntdomain.h" +#include "../lib/tsocket/tsocket.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -- cgit From 50883cfeb4eed3d538f71443060745f8747044c9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Apr 2011 17:38:09 +0200 Subject: s3-tevent: only include ../lib/util/tevent wrappers where needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_ncacn_np.c | 1 + source3/rpc_server/srv_pipe_hnd.c | 1 + 2 files changed, 2 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index bd751788578..2e99da72ed7 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -32,6 +32,7 @@ #include "auth.h" #include "ntdomain.h" #include "../lib/tsocket/tsocket.h" +#include "../lib/util/tevent_ntstatus.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 11689672d6a..6aa9bf8dc2a 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -30,6 +30,7 @@ #include "rpc_server/rpc_ncacn_np.h" #include "ntdomain.h" #include "../lib/tsocket/tsocket.h" +#include "../lib/util/tevent_ntstatus.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -- cgit From 487cb0c96ef8ca05fcef35d0d7c49bc067f6cff7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 16:19:54 +0200 Subject: s3-rpc_server: remove some unneeded headers. Guenther --- source3/rpc_server/srv_pipe_hnd.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 6aa9bf8dc2a..e13c5623519 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -20,11 +20,7 @@ */ #include "includes.h" -#include "../librpc/gen_ndr/srv_spoolss.h" -#include "librpc/gen_ndr/ndr_named_pipe_auth.h" -#include "../libcli/named_pipe_auth/npa_tstream.h" #include "rpc_server.h" -#include "smbd/globals.h" #include "fake_file.h" #include "rpc_dce.h" #include "rpc_server/rpc_ncacn_np.h" -- cgit From bc781bf7d98baca57c8043bf7dc0a95f8ffd1345 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 16:20:27 +0200 Subject: s3-proto: remove duplicate prototypes. Guenther --- source3/rpc_server/rpc_ncacn_np.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index 7c8619b46db..bff7c4f0489 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -20,6 +20,8 @@ #ifndef _RPC_NCACN_NP_H_ #define _RPC_NCACN_NP_H_ +struct dcerpc_binding_handle; + struct np_proxy_state { uint16_t file_type; uint16_t device_state; @@ -57,5 +59,4 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, struct client_address *client_id, struct messaging_context *msg_ctx, struct rpc_pipe_client **cli_pipe); - #endif /* _RPC_NCACN_NP_H_ */ -- cgit From bbacaec4e9365b128eb11467c95412de7473c1ec Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 16:40:24 +0200 Subject: s3-proto: move more headers to rpc_server/rpc_ncacn_np.h where they origin from. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Fri Apr 29 22:05:07 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_handles.c | 1 + source3/rpc_server/rpc_ncacn_np.h | 6 ++++++ source3/rpc_server/rpc_server.c | 1 + 3 files changed, 8 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 889e87e9b5a..0c2789e070d 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -24,6 +24,7 @@ #include "../librpc/gen_ndr/ndr_samr.h" #include "auth.h" #include "ntdomain.h" +#include "rpc_server/rpc_ncacn_np.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index bff7c4f0489..75a9f400878 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -59,4 +59,10 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, struct client_address *client_id, struct messaging_context *msg_ctx, struct rpc_pipe_client **cli_pipe); + +struct pipes_struct *get_first_internal_pipe(void); +struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p); +bool check_open_pipes(void); +int close_internal_rpc_pipe_hnd(struct pipes_struct *p); + #endif /* _RPC_NCACN_NP_H_ */ diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index c7c77f03757..17cbf6d35ad 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -27,6 +27,7 @@ #include "../auth/auth_sam_reply.h" #include "auth.h" #include "ntdomain.h" +#include "rpc_server/rpc_ncacn_np.h" #define SERVER_TCP_LOW_PORT 1024 #define SERVER_TCP_HIGH_PORT 1300 -- cgit From 49d5f62b42d821bb8a11b595efb53eb88ec3c570 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 22:32:12 +0200 Subject: s3-proto: move rpc_srv_register protos and structs to town headerfile. Guenther --- source3/rpc_server/epmd.c | 1 + source3/rpc_server/rpc_ep_setup.c | 1 + source3/rpc_server/rpc_ep_setup.h | 2 ++ source3/rpc_server/rpc_ncacn_np.h | 1 + source3/rpc_server/srv_pipe_register.c | 1 + source3/rpc_server/srv_pipe_register.h | 39 ++++++++++++++++++++++++++++++++++ 6 files changed, 45 insertions(+) create mode 100644 source3/rpc_server/srv_pipe_register.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index 5e82b276fd2..d11760c29b9 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -25,6 +25,7 @@ #include "../librpc/gen_ndr/srv_epmapper.h" #include "rpc_server/rpc_server.h" #include "rpc_server/epmapper/srv_epmapper.h" +#include "rpc_server/srv_pipe_register.h" #include "messages.h" #define DAEMON_NAME "epmd" diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index d517bb88516..fd1297cc0c9 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -46,6 +46,7 @@ #include "rpc_server/rpc_ep_setup.h" #include "rpc_server/rpc_server.h" +#include "rpc_server/srv_pipe_register.h" #include "rpc_server/epmapper/srv_epmapper.h" struct dcesrv_ep_context { diff --git a/source3/rpc_server/rpc_ep_setup.h b/source3/rpc_server/rpc_ep_setup.h index b96de36b16e..57b06abb39f 100644 --- a/source3/rpc_server/rpc_ep_setup.h +++ b/source3/rpc_server/rpc_ep_setup.h @@ -22,6 +22,8 @@ #ifndef _SMBD_RPC_CALLBACKS_H #define _SMBD_RPC_CALLBACKS_H +struct ndr_interface_table; + /** * @brief Register an endpoint at the endpoint mapper. * diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index 75a9f400878..09feaa9f4a7 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -21,6 +21,7 @@ #define _RPC_NCACN_NP_H_ struct dcerpc_binding_handle; +struct ndr_interface_table; struct np_proxy_state { uint16_t file_type; diff --git a/source3/rpc_server/srv_pipe_register.c b/source3/rpc_server/srv_pipe_register.c index a6d654277ed..69d3ed198a0 100644 --- a/source3/rpc_server/srv_pipe_register.c +++ b/source3/rpc_server/srv_pipe_register.c @@ -20,6 +20,7 @@ #include "includes.h" #include "librpc/rpc/dcerpc.h" #include "srv_pipe_internal.h" +#include "rpc_server/srv_pipe_register.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/srv_pipe_register.h b/source3/rpc_server/srv_pipe_register.h new file mode 100644 index 00000000000..b1b454e0bd5 --- /dev/null +++ b/source3/rpc_server/srv_pipe_register.h @@ -0,0 +1,39 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * 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 . + */ + +#ifndef _RPC_SERVER_SRV_PIPE_REGISTER_H_ +#define _RPC_SERVER_SRV_PIPE_REGISTER_H_ + +struct rpc_srv_callbacks { + bool (*init)(void *private_data); + bool (*shutdown)(void *private_data); + void *private_data; +}; + +/* The following definitions come from rpc_server/srv_rpc_register.c */ + +NTSTATUS rpc_srv_register(int version, const char *clnt, + const char *srv, + const struct ndr_interface_table *iface, + const struct api_struct *cmds, int size, + const struct rpc_srv_callbacks *rpc_srv_cb); + +NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface); + +#endif /* _RPC_SERVER_SRV_PIPE_REGISTER_H_ */ -- cgit From c1f3ff734043082a9488c787324e76a37702f94d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 22:34:56 +0200 Subject: s3-util: move valid_share_pathname() to lib/util.c Guenther --- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 34 ------------------------------- 1 file changed, 34 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index e51fee89c61..36f4c18226b 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1512,40 +1512,6 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p, return status; } -/******************************************************************* - Check a given DOS pathname is valid for a share. -********************************************************************/ - -char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname) -{ - char *ptr = NULL; - - if (!dos_pathname) { - return NULL; - } - - ptr = talloc_strdup(ctx, dos_pathname); - if (!ptr) { - return NULL; - } - /* Convert any '\' paths to '/' */ - unix_format(ptr); - ptr = unix_clean_name(ctx, ptr); - if (!ptr) { - return NULL; - } - - /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */ - if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/') - ptr += 2; - - /* Only absolute paths allowed. */ - if (*ptr != '/') - return NULL; - - return ptr; -} - /******************************************************************* _srvsvc_NetShareSetInfo. Modify share details. ********************************************************************/ -- cgit From c6fe379a4637dd1d5db34cbe4f566d3913b21fd2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 22:43:59 +0200 Subject: s3-rpc_server: remove proto of nonexisting function (rpc_pipe_register_commands). Guenther --- source3/rpc_server/srv_pipe_register.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe_register.c b/source3/rpc_server/srv_pipe_register.c index 69d3ed198a0..c3500c97be6 100644 --- a/source3/rpc_server/srv_pipe_register.c +++ b/source3/rpc_server/srv_pipe_register.c @@ -198,7 +198,7 @@ NTSTATUS rpc_srv_register(int version, const char *clnt, const char *srv, rpc_entry = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(rpc_lookup, struct rpc_table, rpc_lookup_size); if (NULL == rpc_entry) { rpc_lookup_size--; - DEBUG(0, ("rpc_pipe_register_commands: memory allocation failed\n")); + DEBUG(0, ("rpc_srv_register: memory allocation failed\n")); return NT_STATUS_NO_MEMORY; } else { rpc_lookup = rpc_entry; -- cgit From 047d8c073b57bc12648a251deaceedb65f4f59cf Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 23:32:28 +0200 Subject: s3-proto: move more rpc_server prototypes out of proto.h Guenther --- source3/rpc_server/rpc_ncacn_np.h | 1 + source3/rpc_server/rpc_server.c | 1 + source3/rpc_server/srv_pipe_hnd.c | 3 ++- source3/rpc_server/srv_pipe_hnd.h | 50 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 source3/rpc_server/srv_pipe_hnd.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index 09feaa9f4a7..edebceaa43f 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -22,6 +22,7 @@ struct dcerpc_binding_handle; struct ndr_interface_table; +struct tsocket_address; struct np_proxy_state { uint16_t file_type; diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 17cbf6d35ad..b66ce6de274 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -28,6 +28,7 @@ #include "auth.h" #include "ntdomain.h" #include "rpc_server/rpc_ncacn_np.h" +#include "rpc_server/srv_pipe_hnd.h" #define SERVER_TCP_LOW_PORT 1024 #define SERVER_TCP_HIGH_PORT 1300 diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index e13c5623519..fa296606a94 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -23,8 +23,9 @@ #include "rpc_server.h" #include "fake_file.h" #include "rpc_dce.h" -#include "rpc_server/rpc_ncacn_np.h" #include "ntdomain.h" +#include "rpc_server/rpc_ncacn_np.h" +#include "rpc_server/srv_pipe_hnd.h" #include "../lib/tsocket/tsocket.h" #include "../lib/util/tevent_ntstatus.h" diff --git a/source3/rpc_server/srv_pipe_hnd.h b/source3/rpc_server/srv_pipe_hnd.h new file mode 100644 index 00000000000..b66d7d42eea --- /dev/null +++ b/source3/rpc_server/srv_pipe_hnd.h @@ -0,0 +1,50 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1998, + * Largely re-written : 2005 + * Copyright (C) Jeremy Allison 1998 - 2005 + * + * 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 . + */ + +#ifndef _RPC_SERVER_SRV_PIPE_HND_H_ +#define _RPC_SERVER_SRV_PIPE_HND_H_ + +struct tsocket_address; + +/* The following definitions come from rpc_server/srv_pipe_hnd.c */ + +bool fsp_is_np(struct files_struct *fsp); +NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, + const struct tsocket_address *local_address, + const struct tsocket_address *remote_address, + struct client_address *client_id, + struct auth_serversupplied_info *session_info, + struct messaging_context *msg_ctx, + struct fake_file_handle **phandle); +bool np_read_in_progress(struct fake_file_handle *handle); +struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct fake_file_handle *handle, + const uint8_t *data, size_t len); +NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten); +struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct fake_file_handle *handle, + uint8_t *data, size_t len); +NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread, + bool *is_data_outstanding); + +ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n); + +#endif /* _RPC_SERVER_SRV_PIPE_HND_H_ */ -- cgit From c233c21425a183dd1124329fdbca13ab92cc6d6a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 23:47:25 +0200 Subject: s3-proto: move remaining spoolss protos to own header file. Guenther --- source3/rpc_server/rpc_ep_setup.c | 1 + source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 + source3/rpc_server/spoolss/srv_spoolss_nt.h | 40 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 source3/rpc_server/spoolss/srv_spoolss_nt.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index fd1297cc0c9..6a48f8890df 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -41,6 +41,7 @@ #include "printing/nt_printing_migrate.h" #include "rpc_server/eventlog/srv_eventlog_reg.h" #include "rpc_server/svcctl/srv_svcctl_reg.h" +#include "rpc_server/spoolss/srv_spoolss_nt.h" #include "librpc/rpc/dcerpc_ep.h" diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 312f50965b7..15630ff93d9 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -49,6 +49,7 @@ #include "auth.h" #include "messages.h" #include "ntdomain.h" +#include "rpc_server/spoolss/srv_spoolss_nt.h" /* macros stolen from s4 spoolss server */ #define SPOOLSS_BUFFER_UNION(fn,info,level) \ diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.h b/source3/rpc_server/spoolss/srv_spoolss_nt.h new file mode 100644 index 00000000000..d6d141a5e8f --- /dev/null +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.h @@ -0,0 +1,40 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-2000, + * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, + * Copyright (C) Jean François Micouleau 1998-2000, + * Copyright (C) Jeremy Allison 2001-2002, + * Copyright (C) Gerald Carter 2000-2004, + * Copyright (C) Tim Potter 2001-2002. + * Copyright (C) Guenther Deschner 2009-2010. + * Copyright (C) Andreas Schneider 2010. + * + * 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 . + */ + +#ifndef _RPC_SERVER_SPOOLSS_SRV_SPOOLSS_NT_H_ +#define _RPC_SERVER_SPOOLSS_SRV_SPOOLSS_NT_H_ + +/* The following definitions come from rpc_server/srv_spoolss_nt.c */ +void srv_spoolss_cleanup(void); + +void do_drv_upgrade_printer(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); +void update_monitored_printq_cache(struct messaging_context *msg_ctx); + +#endif /* _RPC_SERVER_SPOOLSS_SRV_SPOOLSS_NT_H_ */ -- cgit From daa02f34b181a3ec7224e920f787cc677bc3cdf2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Apr 2011 23:57:49 +0200 Subject: s3-proto: move remaining srvsvc protos to own header file. Guenther --- source3/rpc_server/rpc_ep_setup.c | 1 + source3/rpc_server/svcctl/srv_svcctl_nt.c | 1 + source3/rpc_server/svcctl/srv_svcctl_nt.h | 33 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 source3/rpc_server/svcctl/srv_svcctl_nt.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 6a48f8890df..f59f4b535ab 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -42,6 +42,7 @@ #include "rpc_server/eventlog/srv_eventlog_reg.h" #include "rpc_server/svcctl/srv_svcctl_reg.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" +#include "rpc_server/svcctl/srv_svcctl_nt.h" #include "librpc/rpc/dcerpc_ep.h" diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index a4eb282de7c..09e6c006d60 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -30,6 +30,7 @@ #include "services/svc_winreg_glue.h" #include "auth.h" #include "ntdomain.h" +#include "rpc_server/svcctl/srv_svcctl_nt.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.h b/source3/rpc_server/svcctl/srv_svcctl_nt.h new file mode 100644 index 00000000000..dd049272882 --- /dev/null +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.h @@ -0,0 +1,33 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * + * Copyright (C) Marcin Krzysztof Porwit 2005. + * + * Largely Rewritten (Again) by: + * Copyright (C) Gerald (Jerry) Carter 2005. + * Copyright (C) Guenther Deschner 2008,2009. + * + * 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 . + */ + +#ifndef _RPC_SERVER_SVCCTL_SRV_SVCCTL_NT_H_ +#define _RPC_SERVER_SVCCTL_SRV_SVCCTL_NT_H_ + +/* The following definitions come from rpc_server/srv_svcctl_nt.c */ + +bool init_service_op_table( void ); +bool shutdown_service_op_table(void); + +#endif /* _RPC_SERVER_SVCCTL_SRV_SVCCTL_NT_H_ */ -- cgit From cd5b2b242b39437081592d41d297bce0668b40ab Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 30 Apr 2011 00:09:09 +0200 Subject: s3-printing: avoid using pipes_struct when only session_info is needed. Guenther --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 15630ff93d9..e8db6063f80 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -8012,12 +8012,12 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p, } DEBUG(5,("Cleaning driver's information\n")); - err = clean_up_driver_struct(p->mem_ctx, p, r->in.info_ctr); + err = clean_up_driver_struct(p->mem_ctx, p->session_info, r->in.info_ctr); if (!W_ERROR_IS_OK(err)) goto done; DEBUG(5,("Moving driver to final destination\n")); - err = move_driver_to_download_area(p, r->in.info_ctr); + err = move_driver_to_download_area(p->session_info, r->in.info_ctr); if (!W_ERROR_IS_OK(err)) { goto done; } -- cgit From 61cd1067efacd91e22b4acbdf0d1d92dc2efc162 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 30 Apr 2011 00:37:05 +0200 Subject: s3-smbd: avoid using pipes_struct when only session_info is needed. Guenther --- source3/rpc_server/srv_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 27a7aaeaf47..256540965c7 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -1547,7 +1547,7 @@ static bool api_pipe_request(struct pipes_struct *p, ((p->auth.auth_type == DCERPC_AUTH_TYPE_NTLMSSP) || (p->auth.auth_type == DCERPC_AUTH_TYPE_KRB5) || (p->auth.auth_type == DCERPC_AUTH_TYPE_SPNEGO))) { - if(!become_authenticated_pipe_user(p)) { + if(!become_authenticated_pipe_user(p->session_info)) { data_blob_free(&p->out_data.rdata); return False; } -- cgit From 911cdc56c146014058063b872372ff8096c06065 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 2 May 2011 13:19:51 +0200 Subject: s3-rpc_server: add pipes_struct forward declaration. Guenther --- source3/rpc_server/rpc_server.h | 2 ++ source3/rpc_server/srv_pipe_hnd.h | 1 + 2 files changed, 3 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.h b/source3/rpc_server/rpc_server.h index 3791589bb64..41d508c6dc0 100644 --- a/source3/rpc_server/rpc_server.h +++ b/source3/rpc_server/rpc_server.h @@ -20,6 +20,8 @@ #ifndef _RPC_SERVER_H_ #define _RPC_SERVER_H_ +struct pipes_struct; + typedef bool (*dcerpc_ncacn_disconnect_fn)(struct pipes_struct *p); void set_incoming_fault(struct pipes_struct *p); diff --git a/source3/rpc_server/srv_pipe_hnd.h b/source3/rpc_server/srv_pipe_hnd.h index b66d7d42eea..245b71979e4 100644 --- a/source3/rpc_server/srv_pipe_hnd.h +++ b/source3/rpc_server/srv_pipe_hnd.h @@ -23,6 +23,7 @@ #define _RPC_SERVER_SRV_PIPE_HND_H_ struct tsocket_address; +struct pipes_struct; /* The following definitions come from rpc_server/srv_pipe_hnd.c */ -- cgit From 0e76eddcc8a4e7e98167b8f92387fae015fae095 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 2 May 2011 13:21:53 +0200 Subject: s3: include ntdomain.h before including generated srv_ headers. Guenther --- source3/rpc_server/dfs/srv_dfs_nt.c | 2 +- source3/rpc_server/dssetup/srv_dssetup_nt.c | 2 +- source3/rpc_server/echo/srv_echo_nt.c | 2 +- source3/rpc_server/epmapper/srv_epmapper.c | 2 +- source3/rpc_server/epmd.c | 1 + source3/rpc_server/eventlog/srv_eventlog_nt.c | 2 +- source3/rpc_server/initshutdown/srv_initshutdown_nt.c | 2 +- source3/rpc_server/lsa/srv_lsa_nt.c | 2 +- source3/rpc_server/netlogon/srv_netlog_nt.c | 2 +- source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c | 2 +- source3/rpc_server/rpc_ep_setup.c | 1 + source3/rpc_server/rpc_server.c | 2 +- source3/rpc_server/samr/srv_samr_nt.c | 2 +- source3/rpc_server/spoolss/srv_spoolss_nt.c | 2 +- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 1 + source3/rpc_server/svcctl/srv_svcctl_nt.c | 2 +- source3/rpc_server/winreg/srv_winreg_nt.c | 2 +- source3/rpc_server/wkssvc/srv_wkssvc_nt.c | 2 +- 18 files changed, 18 insertions(+), 15 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 45e9d9a6ff3..324af534c9b 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -22,11 +22,11 @@ /* This is the implementation of the dfs pipe. */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_dfs.h" #include "msdfs.h" #include "smbd/smbd.h" #include "auth.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_MSDFS diff --git a/source3/rpc_server/dssetup/srv_dssetup_nt.c b/source3/rpc_server/dssetup/srv_dssetup_nt.c index 73617df99f1..d90ad421371 100644 --- a/source3/rpc_server/dssetup/srv_dssetup_nt.c +++ b/source3/rpc_server/dssetup/srv_dssetup_nt.c @@ -23,9 +23,9 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_dssetup.h" #include "secrets.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/echo/srv_echo_nt.c b/source3/rpc_server/echo/srv_echo_nt.c index 7f27984b8bd..c7a9e1a97da 100644 --- a/source3/rpc_server/echo/srv_echo_nt.c +++ b/source3/rpc_server/echo/srv_echo_nt.c @@ -22,8 +22,8 @@ /* This is the interface to the rpcecho pipe. */ #include "includes.h" -#include "../librpc/gen_ndr/srv_echo.h" #include "ntdomain.h" +#include "../librpc/gen_ndr/srv_echo.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/epmapper/srv_epmapper.c b/source3/rpc_server/epmapper/srv_epmapper.c index d96fd1e929f..14f42d6bc9b 100644 --- a/source3/rpc_server/epmapper/srv_epmapper.c +++ b/source3/rpc_server/epmapper/srv_epmapper.c @@ -20,12 +20,12 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../libcli/security/security.h" #include "librpc/gen_ndr/ndr_epmapper.h" #include "librpc/gen_ndr/srv_epmapper.h" #include "srv_epmapper.h" #include "auth.h" -#include "ntdomain.h" typedef uint32_t error_status_t; diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index d11760c29b9..04fdfb13bb9 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -22,6 +22,7 @@ #include "includes.h" #include "serverid.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_epmapper.h" #include "rpc_server/rpc_server.h" #include "rpc_server/epmapper/srv_epmapper.h" diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c index 2e1c1faa8c5..c0d9499ac09 100644 --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_eventlog.h" #include "lib/eventlog/eventlog.h" #include "registry.h" @@ -30,7 +31,6 @@ #include "rpc_client/cli_winreg.h" #include "smbd/smbd.h" #include "auth.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/initshutdown/srv_initshutdown_nt.c b/source3/rpc_server/initshutdown/srv_initshutdown_nt.c index 8644d95e7d0..9b16d806096 100644 --- a/source3/rpc_server/initshutdown/srv_initshutdown_nt.c +++ b/source3/rpc_server/initshutdown/srv_initshutdown_nt.c @@ -21,9 +21,9 @@ /* Implementation of registry functions. */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_initshutdown.h" #include "../librpc/gen_ndr/srv_winreg.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 9ea872b0276..341bd5d424f 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -30,6 +30,7 @@ /* This is the implementation of the lsa server code. */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_lsa.h" #include "secrets.h" #include "../librpc/gen_ndr/netlogon.h" @@ -43,7 +44,6 @@ #include "../librpc/gen_ndr/ndr_security.h" #include "passdb.h" #include "auth.h" -#include "ntdomain.h" #include "lib/privileges.h" #include "rpc_server/srv_access_check.h" diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index f0535c72953..5df59a5fc9f 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -25,6 +25,7 @@ /* This is the implementation of the netlogon pipe. */ #include "includes.h" +#include "ntdomain.h" #include "../libcli/auth/schannel.h" #include "../librpc/gen_ndr/srv_netlogon.h" #include "../librpc/gen_ndr/srv_samr.h" @@ -45,7 +46,6 @@ #include "passdb.h" #include "auth.h" #include "messages.h" -#include "ntdomain.h" extern userdom_struct current_user_info; diff --git a/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c b/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c index af80254a0b2..0a00e000255 100644 --- a/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c +++ b/source3/rpc_server/ntsvcs/srv_ntsvcs_nt.c @@ -20,10 +20,10 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_ntsvcs.h" #include "services/svc_winreg_glue.h" #include "../libcli/registry/util_reg.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index f59f4b535ab..3cf5af8cbe1 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/ndr_epmapper_c.h" #include "../librpc/gen_ndr/srv_epmapper.h" diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index b66ce6de274..85b17ea3ca9 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "ntdomain.h" #include "rpc_server/rpc_server.h" #include "rpc_dce.h" #include "librpc/gen_ndr/netlogon.h" @@ -26,7 +27,6 @@ #include "libcli/named_pipe_auth/npa_tstream.h" #include "../auth/auth_sam_reply.h" #include "auth.h" -#include "ntdomain.h" #include "rpc_server/rpc_ncacn_np.h" #include "rpc_server/srv_pipe_hnd.h" diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 99dd3f4d585..8ff097c2cf3 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -35,6 +35,7 @@ #include "system/passwd.h" #include "smbd/globals.h" #include "../libcli/auth/libcli_auth.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_samr.h" #include "rpc_server/samr/srv_samr_util.h" #include "../lib/crypto/arcfour.h" @@ -43,7 +44,6 @@ #include "../libcli/security/security.h" #include "passdb.h" #include "auth.h" -#include "ntdomain.h" #include "rpc_server/srv_access_check.h" #undef DBGC_CLASS diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index e8db6063f80..02587cae0dd 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -28,6 +28,7 @@ up, all the errors returned are DOS errors, not NT status codes. */ #include "includes.h" +#include "ntdomain.h" #include "nt_printing.h" #include "srv_spoolss_util.h" #include "../librpc/gen_ndr/srv_spoolss.h" @@ -48,7 +49,6 @@ #include "smbd/smbd.h" #include "auth.h" #include "messages.h" -#include "ntdomain.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" /* macros stolen from s4 spoolss server */ diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 36f4c18226b..73dc2ed4f69 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -25,6 +25,7 @@ #include "includes.h" #include "system/passwd.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_srvsvc.h" #include "../libcli/security/security.h" #include "../librpc/gen_ndr/ndr_security.h" diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index 09e6c006d60..bf7ade8be6c 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -23,13 +23,13 @@ */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_svcctl.h" #include "../libcli/security/security.h" #include "../librpc/gen_ndr/ndr_security.h" #include "services/services.h" #include "services/svc_winreg_glue.h" #include "auth.h" -#include "ntdomain.h" #include "rpc_server/svcctl/srv_svcctl_nt.h" #undef DBGC_CLASS diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c index fedb665a30b..1b3cab88447 100644 --- a/source3/rpc_server/winreg/srv_winreg_nt.c +++ b/source3/rpc_server/winreg/srv_winreg_nt.c @@ -21,6 +21,7 @@ /* Implementation of registry functions. */ #include "includes.h" +#include "ntdomain.h" #include "../librpc/gen_ndr/srv_winreg.h" #include "registry.h" #include "registry/reg_api.h" @@ -28,7 +29,6 @@ #include "registry/reg_perfcount.h" #include "rpc_misc.h" #include "auth.h" -#include "ntdomain.h" #include "lib/privileges.h" #undef DBGC_CLASS diff --git a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c index d44414f7767..cd257b4a26f 100644 --- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c +++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c @@ -23,6 +23,7 @@ /* This is the implementation of the wks interface. */ #include "includes.h" +#include "ntdomain.h" #include "librpc/gen_ndr/libnet_join.h" #include "libnet/libnet_join.h" #include "../libcli/auth/libcli_auth.h" @@ -31,7 +32,6 @@ #include "session.h" #include "smbd/smbd.h" #include "auth.h" -#include "ntdomain.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -- cgit From 1a561dedb9995f52411d2fed2c6e0cc1e37a85d1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 2 May 2011 13:25:19 +0200 Subject: s3-spoolss: remove another unused header. Guenther --- source3/rpc_server/spoolss/srv_spoolss_util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index 9e9e253dd71..c8e96e077dd 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -23,7 +23,6 @@ #include "nt_printing.h" #include "srv_spoolss_util.h" #include "../librpc/gen_ndr/ndr_spoolss.h" -#include "../librpc/gen_ndr/srv_winreg.h" #include "../librpc/gen_ndr/ndr_winreg_c.h" #include "../librpc/gen_ndr/ndr_security.h" #include "secrets.h" -- cgit From 56cd3b3bbbb595cb0c98fa2dfa397c915fbf37d2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 2 May 2011 13:27:45 +0200 Subject: s3-rpc_server: (re)move last globally included rpc_server prototypes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Mon May 2 16:05:31 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_server.c | 1 + source3/rpc_server/srv_pipe.c | 1 + source3/rpc_server/srv_pipe.h | 33 +++++++++++++++++++++++++++++++++ source3/rpc_server/srv_pipe_hnd.c | 1 + 4 files changed, 36 insertions(+) create mode 100644 source3/rpc_server/srv_pipe.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 85b17ea3ca9..cdde40c2df4 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -29,6 +29,7 @@ #include "auth.h" #include "rpc_server/rpc_ncacn_np.h" #include "rpc_server/srv_pipe_hnd.h" +#include "rpc_server/srv_pipe.h" #define SERVER_TCP_LOW_PORT 1024 #define SERVER_TCP_HIGH_PORT 1300 diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 256540965c7..72c8f809593 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -41,6 +41,7 @@ #include "smbd/smbd.h" #include "auth.h" #include "ntdomain.h" +#include "rpc_server/srv_pipe.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/srv_pipe.h b/source3/rpc_server/srv_pipe.h new file mode 100644 index 00000000000..453cca18d91 --- /dev/null +++ b/source3/rpc_server/srv_pipe.h @@ -0,0 +1,33 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * 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 . + */ + +#ifndef _RPC_SERVER_SRV_PIPE_H_ +#define _RPC_SERVER_SRV_PIPE_H_ + +struct ncacn_packet; +struct pipes_struct; + +/* The following definitions come from rpc_server/srv_pipe.c */ + +bool create_next_pdu(struct pipes_struct *p); +bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt); +bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status); +bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax); + +#endif /* _RPC_SERVER_SRV_PIPE_H_ */ diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index fa296606a94..0c128a0ac55 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -26,6 +26,7 @@ #include "ntdomain.h" #include "rpc_server/rpc_ncacn_np.h" #include "rpc_server/srv_pipe_hnd.h" +#include "rpc_server/srv_pipe.h" #include "../lib/tsocket/tsocket.h" #include "../lib/util/tevent_ntstatus.h" -- cgit From 8380835fc6de38706d9af29dc7f0fa4cec4f9c90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 May 2011 11:38:26 -0700 Subject: Fix warning messages caused by addition of null check in fstrcpy macro. --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 02587cae0dd..c50e2845936 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -727,7 +727,7 @@ static WERROR set_printer_hnd_name(TALLOC_CTX *mem_ctx, DEBUGADD(4,("set_printer_hnd_name: Printer found: %s -> %s\n", aprinter, sname)); - fstrcpy(Printer->sharename, sname); + strlcpy(Printer->sharename, sname, sizeof(Printer->sharename)); return WERR_OK; } -- cgit From 8563d5c384f672276d8ea2ab20a1810ff485e37d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 5 May 2011 00:58:27 +0200 Subject: s3-rpc_server: run minimal_includes.pl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Thu May 5 03:04:38 CEST 2011 on sn-devel-104 --- source3/rpc_server/epmapper/srv_epmapper.c | 1 - source3/rpc_server/epmd.c | 1 - source3/rpc_server/eventlog/srv_eventlog_nt.c | 1 - source3/rpc_server/netlogon/srv_netlog_nt.c | 2 -- source3/rpc_server/rpc_ep_setup.c | 1 - source3/rpc_server/samr/srv_samr_nt.c | 1 - source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 1 - 7 files changed, 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/epmapper/srv_epmapper.c b/source3/rpc_server/epmapper/srv_epmapper.c index 14f42d6bc9b..70f665dadf6 100644 --- a/source3/rpc_server/epmapper/srv_epmapper.c +++ b/source3/rpc_server/epmapper/srv_epmapper.c @@ -22,7 +22,6 @@ #include "includes.h" #include "ntdomain.h" #include "../libcli/security/security.h" -#include "librpc/gen_ndr/ndr_epmapper.h" #include "librpc/gen_ndr/srv_epmapper.h" #include "srv_epmapper.h" #include "auth.h" diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index 04fdfb13bb9..4e2056e5068 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -26,7 +26,6 @@ #include "../librpc/gen_ndr/srv_epmapper.h" #include "rpc_server/rpc_server.h" #include "rpc_server/epmapper/srv_epmapper.h" -#include "rpc_server/srv_pipe_register.h" #include "messages.h" #define DAEMON_NAME "epmd" diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c index c0d9499ac09..b63d1ab5f55 100644 --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c @@ -24,7 +24,6 @@ #include "ntdomain.h" #include "../librpc/gen_ndr/srv_eventlog.h" #include "lib/eventlog/eventlog.h" -#include "registry.h" #include "../libcli/security/security.h" #include "../librpc/gen_ndr/ndr_winreg_c.h" #include "rpc_client/cli_winreg_int.h" diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index 5df59a5fc9f..e3c95fc06bc 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -28,8 +28,6 @@ #include "ntdomain.h" #include "../libcli/auth/schannel.h" #include "../librpc/gen_ndr/srv_netlogon.h" -#include "../librpc/gen_ndr/srv_samr.h" -#include "../librpc/gen_ndr/srv_lsa.h" #include "../librpc/gen_ndr/ndr_samr_c.h" #include "../librpc/gen_ndr/ndr_lsa_c.h" #include "rpc_client/cli_lsarpc.h" diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 3cf5af8cbe1..d00b35161c6 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -49,7 +49,6 @@ #include "rpc_server/rpc_ep_setup.h" #include "rpc_server/rpc_server.h" -#include "rpc_server/srv_pipe_register.h" #include "rpc_server/epmapper/srv_epmapper.h" struct dcesrv_ep_context { diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 8ff097c2cf3..41e684d63d7 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -33,7 +33,6 @@ #include "includes.h" #include "system/passwd.h" -#include "smbd/globals.h" #include "../libcli/auth/libcli_auth.h" #include "ntdomain.h" #include "../librpc/gen_ndr/srv_samr.h" diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 73dc2ed4f69..472a31860e5 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -35,7 +35,6 @@ #include "smbd/smbd.h" #include "auth.h" #include "messages.h" -#include "ntdomain.h" extern const struct generic_mapping file_generic_mapping; -- cgit From 7d6ebe0de7d99c20854cafb8af50fe8f30ed778a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 5 May 2011 16:19:49 -0700 Subject: More const fixes. Remove CONST_DISCARD. --- source3/rpc_server/rpc_handles.c | 4 ++-- source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 ++-- source3/rpc_server/srv_pipe_hnd.c | 10 +++++----- source3/rpc_server/srv_pipe_hnd.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 0c2789e070d..493149b2c3b 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -230,7 +230,7 @@ static struct dcesrv_handle *find_policy_by_hnd_internal(struct pipes_struct *p, for (h = p->pipe_handles->handles; h != NULL; h = h->next) { if (memcmp(&h->wire_handle, hnd, sizeof(*hnd)) == 0) { DEBUG(4,("Found policy hnd[%u] ", count)); - dump_data(4, (uint8 *)hnd, sizeof(*hnd)); + dump_data(4, (const uint8 *)hnd, sizeof(*hnd)); if (data_p) { *data_p = h->data; } @@ -240,7 +240,7 @@ static struct dcesrv_handle *find_policy_by_hnd_internal(struct pipes_struct *p, } DEBUG(4,("Policy not found: ")); - dump_data(4, (uint8_t *)hnd, sizeof(*hnd)); + dump_data(4, (const uint8_t *)hnd, sizeof(*hnd)); p->bad_handle_fault_state = true; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index c50e2845936..720564f88d5 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -575,7 +575,7 @@ static WERROR set_printer_hnd_name(TALLOC_CTX *mem_ctx, DEBUG(4,("Setting printer name=%s (len=%lu)\n", handlename, (unsigned long)strlen(handlename))); - aprinter = CONST_DISCARD(char *, handlename); + aprinter = discard_const_p(char, handlename); if ( *handlename == '\\' ) { servername = canon_servername(handlename); if ( (aprinter = strchr_m( servername, '\\' )) != NULL ) { @@ -1501,7 +1501,7 @@ static bool srv_spoolss_drv_upgrade_printer(const char *drivername, messaging_send_buf(msg_ctx, messaging_server_id(msg_ctx), MSG_PRINTER_DRVUPGRADE, - (uint8_t *)drivername, len+1); + (const uint8_t *)drivername, len+1); return true; } diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 0c128a0ac55..5702a0e8d71 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -37,7 +37,7 @@ Ensures we have at least RPC_HEADER_LEN amount of data in the incoming buffer. ****************************************************************************/ -static ssize_t fill_rpc_header(struct pipes_struct *p, char *data, size_t data_to_copy) +static ssize_t fill_rpc_header(struct pipes_struct *p, const char *data, size_t data_to_copy) { size_t len_needed_to_complete_hdr = MIN(data_to_copy, RPC_HEADER_LEN - p->in_data.pdu.length); @@ -126,7 +126,7 @@ static void free_pipe_context(struct pipes_struct *p) Accepts incoming data on an rpc pipe. Processes the data in pdu sized units. ****************************************************************************/ -ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n) +ssize_t process_incoming_data(struct pipes_struct *p, const char *data, size_t n) { size_t data_to_copy = MIN(n, RPC_MAX_PDU_FRAG_LEN - p->in_data.pdu.length); @@ -231,7 +231,7 @@ ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n) Accepts incoming data on an internal rpc pipe. ****************************************************************************/ -static ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n) +static ssize_t write_to_internal_pipe(struct pipes_struct *p, const char *data, size_t n) { size_t data_left = n; @@ -535,7 +535,7 @@ struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct pipes_struct *p = talloc_get_type_abort( handle->private_data, struct pipes_struct); - state->nwritten = write_to_internal_pipe(p, (char *)data, len); + state->nwritten = write_to_internal_pipe(p, (const char *)data, len); status = (state->nwritten >= 0) ? NT_STATUS_OK : NT_STATUS_UNEXPECTED_IO_ERROR; @@ -549,7 +549,7 @@ struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, state->ev = ev; state->p = p; - state->iov.iov_base = CONST_DISCARD(void *, data); + state->iov.iov_base = discard_const_p(void, data); state->iov.iov_len = len; subreq = tstream_writev_queue_send(state, ev, diff --git a/source3/rpc_server/srv_pipe_hnd.h b/source3/rpc_server/srv_pipe_hnd.h index 245b71979e4..680add469b0 100644 --- a/source3/rpc_server/srv_pipe_hnd.h +++ b/source3/rpc_server/srv_pipe_hnd.h @@ -46,6 +46,6 @@ struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev, NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread, bool *is_data_outstanding); -ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n); +ssize_t process_incoming_data(struct pipes_struct *p, const char *data, size_t n); #endif /* _RPC_SERVER_SRV_PIPE_HND_H_ */ -- cgit From d8cfca3a9bd2b6b6c562fd202377d95a98eb5472 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 5 May 2011 11:25:29 +0200 Subject: s3: only include tdb headers where needed. Guenther --- source3/rpc_server/eventlog/srv_eventlog_nt.c | 1 + source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 + 2 files changed, 2 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c index b63d1ab5f55..b4c59ba5174 100644 --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c @@ -30,6 +30,7 @@ #include "rpc_client/cli_winreg.h" #include "smbd/smbd.h" #include "auth.h" +#include "util_tdb.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 720564f88d5..c88faa363f2 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -50,6 +50,7 @@ #include "auth.h" #include "messages.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" +#include "util_tdb.h" /* macros stolen from s4 spoolss server */ #define SPOOLSS_BUFFER_UNION(fn,info,level) \ -- cgit From ab8219a6f39360da742d0f3ca702f2173d798538 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 5 May 2011 21:52:57 +0200 Subject: s3-spoolss: remove unused struct in construct_notify_printer_info(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Fri May 6 12:07:17 CEST 2011 on sn-devel-104 --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index c88faa363f2..38523fc4954 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -3406,7 +3406,6 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx, uint16_t field; struct spoolss_Notify *current_data; - print_queue_struct *queue=NULL; type = option_type->type; @@ -3440,7 +3439,7 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx, pinfo2->printername)); notify_info_data_table[j].fn(msg_ctx, snum, current_data, - queue, pinfo2, mem_ctx); + NULL, pinfo2, mem_ctx); info->count++; } -- cgit From 27022587e31769718ab53f4d114e03ac2f205f27 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 May 2011 11:47:43 +0200 Subject: s3-libsmb: move protos to libsmb/proto.h Guenther --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 38523fc4954..711939474c4 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -51,6 +51,7 @@ #include "messages.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" #include "util_tdb.h" +#include "libsmb/libsmb.h" /* macros stolen from s4 spoolss server */ #define SPOOLSS_BUFFER_UNION(fn,info,level) \ -- cgit From aae9353ecf56323b63da66aa84d8a0a4f219d94d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 8 May 2011 10:29:27 +0200 Subject: ncalrpc: Force ncalrpc dir to be mode 755 in all users This allows this directory to be shared between Samba3 and Samba4 in a Franky-style setup easily. Andrew Bartlett --- source3/rpc_server/rpc_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index cdde40c2df4..cb6fbf0b007 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -891,13 +891,13 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, return false; } - if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0700)) { + if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) { DEBUG(0, ("Failed to create pipe directory %s - %s\n", lp_ncalrpc_dir(), strerror(errno))); goto out; } - state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0700); + state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755); if (state->fd == -1) { DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n", lp_ncalrpc_dir(), name)); -- cgit From d31181214cee1ce459b58f0ca60b40a38f396dac Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 11 May 2011 16:38:46 -0400 Subject: rpc_server: Always use rpc_pipe_open_interface() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way we can configure which rpc service we actually want to connect to. By default it uses an "embedded" interface and calls rpc_pipe_open_internal() Signed-off-by: Günther Deschner Autobuild-User: Günther Deschner Autobuild-Date: Fri May 13 14:40:26 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_ncacn_np.c | 53 +++++++++++++++++++++++---------------- source3/rpc_server/rpc_ncacn_np.h | 6 ----- 2 files changed, 31 insertions(+), 28 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 2e99da72ed7..9328322f200 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -519,7 +519,8 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, * @brief Create a new RPC client context which uses a local transport. * * This creates a local transport. It is a shortcut to directly call the server - * functions and avoid marschalling. + * functions and avoid marshalling. + * NOTE: this function should be used only by rpc_pipe_open_interface() * * @param[in] mem_ctx The memory context to use. * @@ -536,19 +537,8 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, * * @return NT_STATUS_OK on success, a corresponding NT status if an * error occured. - * - * @code - * struct rpc_pipe_client *winreg_pipe; - * NTSTATUS status; - * - * status = rpc_pipe_open_internal(tmp_ctx, - * &ndr_table_winreg.syntax_id, - * p->session_info, - * client_id, - * &winreg_pipe); - * @endcode */ -NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax, const struct auth_serversupplied_info *serversupplied_info, struct client_address *client_id, @@ -833,17 +823,36 @@ done: } /** - * @brief Create a new RPC client context which uses a local dispatch function. + * @brief Create a new RPC client context which uses a local dispatch function + * or a remote transport, depending on rpc_server configuration for the + * specific service. + * + * @param[in] mem_ctx The memory context to use. + * + * @param[in] abstract_syntax Normally the syntax_id of the autogenerated + * ndr_table_. + * + * @param[in] serversupplied_info The server supplied authentication function. * - * @param mem_ctx The memory context on which thje pipe will ultimately - * be allocated - * @param name The pipe name to connect to. - * @param session_info Credentials to use for the connection. - * @param pipe [in|out] Checks if a pipe is connected, and connects it - * if not + * @param[in] client_id The client address information. + * + * @param[in] msg_ctx The messaging context to use. * - * @return NT_STATUS_OK on success, a corresponding NT status if - * an error occured. + * @param[out] presult A pointer to store the connected rpc client pipe. + * + * @return NT_STATUS_OK on success, a corresponding NT status if an + * error occured. + * + * @code + * struct rpc_pipe_client *winreg_pipe; + * NTSTATUS status; + * + * status = rpc_pipe_open_interface(tmp_ctx, + * &ndr_table_winreg.syntax_id, + * p->session_info, + * client_id, + * &winreg_pipe); + * @endcode */ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_server/rpc_ncacn_np.h b/source3/rpc_server/rpc_ncacn_np.h index edebceaa43f..3d9a170cdc9 100644 --- a/source3/rpc_server/rpc_ncacn_np.h +++ b/source3/rpc_server/rpc_ncacn_np.h @@ -49,12 +49,6 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx, const struct auth_serversupplied_info *session_info, struct messaging_context *msg_ctx, struct dcerpc_binding_handle **binding_handle); -NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, - const struct ndr_syntax_id *abstract_syntax, - const struct auth_serversupplied_info *serversupplied_info, - struct client_address *client_id, - struct messaging_context *msg_ctx, - struct rpc_pipe_client **presult); NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax, const struct auth_serversupplied_info *session_info, -- cgit From da1fa201040b2dab89fdc99663155a1c79ad4de9 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 13 May 2011 10:28:20 +0200 Subject: s3-spoolss: Get the printer location from cups. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 711939474c4..e03f028c858 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -52,6 +52,7 @@ #include "rpc_server/spoolss/srv_spoolss_nt.h" #include "util_tdb.h" #include "libsmb/libsmb.h" +#include "printing/printer_list.h" /* macros stolen from s4 spoolss server */ #define SPOOLSS_BUFFER_UNION(fn,info,level) \ @@ -2879,7 +2880,21 @@ static void spoolss_notify_location(struct messaging_context *msg_ctx, struct spoolss_PrinterInfo2 *pinfo2, TALLOC_CTX *mem_ctx) { - SETUP_SPOOLSS_NOTIFY_DATA_STRING(data, pinfo2->location); + const char *loc = pinfo2->location; + NTSTATUS status; + + status = printer_list_get_printer(mem_ctx, + pinfo2->sharename, + NULL, + &loc, + NULL); + if (NT_STATUS_IS_OK(status)) { + if (loc == NULL) { + loc = pinfo2->location; + } + } + + SETUP_SPOOLSS_NOTIFY_DATA_STRING(data, loc); } /******************************************************************* @@ -4011,8 +4026,24 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx, } W_ERROR_HAVE_NO_MEMORY(r->comment); - r->location = talloc_strdup(mem_ctx, info2->location); + r->location = talloc_strdup(mem_ctx, info2->location); + if (info2->location[0] == '\0') { + const char *loc = NULL; + NTSTATUS nt_status; + + nt_status = printer_list_get_printer(mem_ctx, + info2->sharename, + NULL, + &loc, + NULL); + if (NT_STATUS_IS_OK(nt_status)) { + if (loc != NULL) { + r->location = talloc_strdup(mem_ctx, loc); + } + } + } W_ERROR_HAVE_NO_MEMORY(r->location); + r->sepfile = talloc_strdup(mem_ctx, info2->sepfile); W_ERROR_HAVE_NO_MEMORY(r->sepfile); r->printprocessor = talloc_strdup(mem_ctx, info2->printprocessor); -- cgit From a032c9c8fe8aff455407485169b9445860f89606 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 16 May 2011 16:50:51 +0200 Subject: s3-rpc_server: Force ncalrpc dir to be mode 755. This completes aae9353ecf56323b63da66aa84d8a0a4f219d94d. directory_create_or_exist() is not needed cause create_pipe_sock() takes care of setting up the directory correctly. Andrew please check! Autobuild-User: Andreas Schneider Autobuild-Date: Mon May 16 17:54:20 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_server.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index cb6fbf0b007..b46c45194b5 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -267,13 +267,7 @@ bool setup_named_pipe_socket(const char *pipe_name, goto out; } - if (!directory_create_or_exist(np_dir, geteuid(), 0700)) { - DEBUG(0, ("Failed to create pipe directory %s - %s\n", - np_dir, strerror(errno))); - goto out; - } - - state->fd = create_pipe_sock(np_dir, pipe_name, 0700); + state->fd = create_pipe_sock(np_dir, pipe_name, 0755); if (state->fd == -1) { DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n", np_dir, pipe_name)); @@ -891,12 +885,6 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, return false; } - if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) { - DEBUG(0, ("Failed to create pipe directory %s - %s\n", - lp_ncalrpc_dir(), strerror(errno))); - goto out; - } - state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755); if (state->fd == -1) { DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n", -- cgit From e0624f773c1c6093fba351e859f411ee09a83c8f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 17 May 2011 10:31:14 +0200 Subject: Revert "s3-rpc_server: Force ncalrpc dir to be mode 755." This reverts commit a032c9c8fe8aff455407485169b9445860f89606. --- source3/rpc_server/rpc_server.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index b46c45194b5..cb6fbf0b007 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -267,7 +267,13 @@ bool setup_named_pipe_socket(const char *pipe_name, goto out; } - state->fd = create_pipe_sock(np_dir, pipe_name, 0755); + if (!directory_create_or_exist(np_dir, geteuid(), 0700)) { + DEBUG(0, ("Failed to create pipe directory %s - %s\n", + np_dir, strerror(errno))); + goto out; + } + + state->fd = create_pipe_sock(np_dir, pipe_name, 0700); if (state->fd == -1) { DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n", np_dir, pipe_name)); @@ -885,6 +891,12 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, return false; } + if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) { + DEBUG(0, ("Failed to create pipe directory %s - %s\n", + lp_ncalrpc_dir(), strerror(errno))); + goto out; + } + state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755); if (state->fd == -1) { DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n", -- cgit From cb227d6d1492247d8aff03807cac0b7266202a38 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 17 May 2011 10:32:38 +0200 Subject: s3:rpc_server: create lp_ncalrpc_dir() with 0755 before lp_ncalrpc_dir()/np with 0700 metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Tue May 17 13:01:14 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_server.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index cb6fbf0b007..3f81a2ff386 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -261,6 +261,17 @@ bool setup_named_pipe_socket(const char *pipe_name, } state->fd = -1; + /* + * As lp_ncalrpc_dir() should have 0755, but + * lp_ncalrpc_dir()/np should have 0700, we need to + * create lp_ncalrpc_dir() first. + */ + if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) { + DEBUG(0, ("Failed to create pipe directory %s - %s\n", + lp_ncalrpc_dir(), strerror(errno))); + goto out; + } + np_dir = talloc_asprintf(state, "%s/np", lp_ncalrpc_dir()); if (!np_dir) { DEBUG(0, ("Out of memory\n")); -- cgit From d17367bd6874ccc2d0e84b478ea3e12d91a9bd99 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 May 2011 21:08:06 +1000 Subject: build: Add depenencies needed by Samba3 subsystems --- source3/rpc_server/wscript_build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index eb24f06268e..dec837842fc 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -27,7 +27,7 @@ bld.SAMBA3_SUBSYSTEM('rpc', bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', source='rpc_ncacn_np.c rpc_handles.c', - deps='auth_sam_reply') + deps='auth_sam_reply RPC_PIPE_REGISTER AUTH_COMMON npa_tstream') bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', source='rpc_server.c') @@ -87,6 +87,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_NTSVCS', bld.SAMBA3_SUBSYSTEM('RPC_NETLOGON', source=RPC_NETLOGON_SRC, + deps='RPC_NCACN_NP', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_NETDFS', @@ -99,7 +100,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SRVSVC', bld.SAMBA3_SUBSYSTEM('RPC_SPOOLSS', source=RPC_SPOOLSS_SRC, - deps='cups PRINTING PRINTBACKEND LIBCLI_WINREG', + deps='cups PRINTING PRINTBACKEND LIBCLI_WINREG RPC_NCACN_NP', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_EVENTLOG', -- cgit From c615ebed6e3d273a682806b952d543e834e5630d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 13 May 2011 20:21:30 +0200 Subject: s3-lib Replace StrCaseCmp() with strcasecmp_m() strcasecmp_m() never needs to call to talloc, and via next_codepoint() still has an ASCII fast-path bypassing iconv() calls. Andrew Bartlett --- source3/rpc_server/lsa/srv_lsa_nt.c | 8 ++-- source3/rpc_server/rpc_ep_setup.c | 66 ++++++++++++++--------------- source3/rpc_server/rpc_ncacn_np.c | 6 +-- source3/rpc_server/spoolss/srv_spoolss_nt.c | 22 +++++----- source3/rpc_server/srv_pipe_hnd.c | 2 +- 5 files changed, 52 insertions(+), 52 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 341bd5d424f..da0f697dc98 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -3488,7 +3488,7 @@ static int dns_cmp(const char *s1, size_t l1, int cret; if (l1 == l2) { - if (StrCaseCmp(s1, s2) == 0) { + if (strcasecmp_m(s1, s2) == 0) { return DNS_CMP_MATCH; } return DNS_CMP_NO_MATCH; @@ -3512,7 +3512,7 @@ static int dns_cmp(const char *s1, size_t l1, return DNS_CMP_NO_MATCH; } - if (StrCaseCmp(&p1[t1 - t2], p2) == 0) { + if (strcasecmp_m(&p1[t1 - t2], p2) == 0) { return cret; } @@ -3701,7 +3701,7 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx, sid_conflict = true; } if (!(trec->flags & LSA_NB_DISABLED_ADMIN) && - StrCaseCmp(trec->data.info.netbios_name.string, + strcasecmp_m(trec->data.info.netbios_name.string, nb_name) == 0) { nb_conflict = true; } @@ -3876,7 +3876,7 @@ NTSTATUS _lsa_lsaRSetForestTrustInformation(struct pipes_struct *p, if (domains[i]->domain_name == NULL) { return NT_STATUS_INVALID_DOMAIN_STATE; } - if (StrCaseCmp(domains[i]->domain_name, + if (strcasecmp_m(domains[i]->domain_name, r->in.trusted_domain_name->string) == 0) { break; } diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index d00b35161c6..2dc54bd812c 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -423,8 +423,8 @@ static bool winreg_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -471,8 +471,8 @@ static bool srvsvc_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -520,8 +520,8 @@ static bool lsarpc_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -569,8 +569,8 @@ static bool samr_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -618,8 +618,8 @@ static bool netlogon_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -673,8 +673,8 @@ static bool spoolss_init_cb(void *ptr) return false; } - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; status =rpc_ep_setup_register(ep_ctx->ev_ctx, @@ -717,8 +717,8 @@ static bool svcctl_init_cb(void *ptr) /* initialize the control hooks */ init_service_op_table(); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; status = rpc_ep_setup_register(ep_ctx->ev_ctx, @@ -752,8 +752,8 @@ static bool ntsvcs_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; status = rpc_ep_setup_register(ep_ctx->ev_ctx, @@ -786,8 +786,8 @@ static bool eventlog_init_cb(void *ptr) return false; } - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; status =rpc_ep_setup_register(ep_ctx->ev_ctx, @@ -814,8 +814,8 @@ static bool initshutdown_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; status = rpc_ep_setup_register(ep_ctx->ev_ctx, @@ -843,8 +843,8 @@ static bool rpcecho_init_cb(void *ptr) { "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; port = _open_sockets(ep_ctx->ev_ctx, @@ -883,8 +883,8 @@ static bool netdfs_init_cb(void *ptr) "rpc_server", "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -932,8 +932,8 @@ static bool dssetup_init_cb(void *ptr) "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -980,8 +980,8 @@ static bool wkssvc_init_cb(void *ptr) "rpc_server", "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0 || + strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; bool ok; @@ -1056,7 +1056,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx, "rpc_server", "epmapper", "none"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { epmapper_cb.init = epmapper_init_cb; epmapper_cb.shutdown = epmapper_shutdown_cb; epmapper_cb.private_data = ep_ctx; @@ -1064,7 +1064,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx, if (!NT_STATUS_IS_OK(rpc_epmapper_init(&epmapper_cb))) { return false; } - } else if (StrCaseCmp(rpcsrv_type, "daemon") == 0) { + } else if (strcasecmp_m(rpcsrv_type, "daemon") == 0) { if (!NT_STATUS_IS_OK(rpc_epmapper_init(NULL))) { return false; } @@ -1110,15 +1110,15 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx, "rpc_server", "spoolss", "embedded"); - if (StrCaseCmp(rpcsrv_type, "embedded") == 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { spoolss_cb.init = spoolss_init_cb; spoolss_cb.shutdown = spoolss_shutdown_cb; spoolss_cb.private_data = ep_ctx; if (!NT_STATUS_IS_OK(rpc_spoolss_init(&spoolss_cb))) { return false; } - } else if (StrCaseCmp(rpcsrv_type, "daemon") == 0 || - StrCaseCmp(rpcsrv_type, "external") == 0) { + } else if (strcasecmp_m(rpcsrv_type, "daemon") == 0 || + strcasecmp_m(rpcsrv_type, "external") == 0) { if (!NT_STATUS_IS_OK(rpc_spoolss_init(NULL))) { return false; } diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 9328322f200..36ee3038e57 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -895,7 +895,7 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, "rpc_server", pipe_name, "embedded"); - if (StrCaseCmp(server_type, "embedded") == 0) { + if (strcasecmp_m(server_type, "embedded") == 0) { status = rpc_pipe_open_internal(tmp_ctx, syntax, session_info, client_id, msg_ctx, @@ -903,8 +903,8 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { goto done; } - } else if (StrCaseCmp(server_type, "daemon") == 0 || - StrCaseCmp(server_type, "external") == 0) { + } else if (strcasecmp_m(server_type, "daemon") == 0 || + strcasecmp_m(server_type, "external") == 0) { /* It would be nice to just use rpc_pipe_open_ncalrpc() but * for now we need to use the special proxy setup to connect * to spoolssd. */ diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index e03f028c858..fce4fd8648c 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -2339,32 +2339,32 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, { DEBUG(8,("getprinterdata_printer_server:%s\n", value)); - if (!StrCaseCmp(value, "W3SvcInstalled")) { + if (!strcasecmp_m(value, "W3SvcInstalled")) { *type = REG_DWORD; data->value = 0x00; return WERR_OK; } - if (!StrCaseCmp(value, "BeepEnabled")) { + if (!strcasecmp_m(value, "BeepEnabled")) { *type = REG_DWORD; data->value = 0x00; return WERR_OK; } - if (!StrCaseCmp(value, "EventLog")) { + if (!strcasecmp_m(value, "EventLog")) { *type = REG_DWORD; /* formally was 0x1b */ data->value = 0x00; return WERR_OK; } - if (!StrCaseCmp(value, "NetPopup")) { + if (!strcasecmp_m(value, "NetPopup")) { *type = REG_DWORD; data->value = 0x00; return WERR_OK; } - if (!StrCaseCmp(value, "MajorVersion")) { + if (!strcasecmp_m(value, "MajorVersion")) { *type = REG_DWORD; /* Windows NT 4.0 seems to not allow uploading of drivers @@ -2381,7 +2381,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!StrCaseCmp(value, "MinorVersion")) { + if (!strcasecmp_m(value, "MinorVersion")) { *type = REG_DWORD; data->value = 0x00; return WERR_OK; @@ -2394,7 +2394,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, * uint32_t build = [2195|2600] * extra unicode string = e.g. "Service Pack 3" */ - if (!StrCaseCmp(value, "OSVersion")) { + if (!strcasecmp_m(value, "OSVersion")) { DATA_BLOB blob; enum ndr_err_code ndr_err; struct spoolss_OSVersion os; @@ -2417,7 +2417,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, } - if (!StrCaseCmp(value, "DefaultSpoolDirectory")) { + if (!strcasecmp_m(value, "DefaultSpoolDirectory")) { *type = REG_SZ; data->string = talloc_strdup(mem_ctx, "C:\\PRINTERS"); @@ -2426,7 +2426,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!StrCaseCmp(value, "Architecture")) { + if (!strcasecmp_m(value, "Architecture")) { *type = REG_SZ; data->string = talloc_strdup(mem_ctx, lp_parm_const_string(GLOBAL_SECTION_SNUM, "spoolss", "architecture", SPOOLSS_ARCHITECTURE_NT_X86)); @@ -2435,7 +2435,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!StrCaseCmp(value, "DsPresent")) { + if (!strcasecmp_m(value, "DsPresent")) { *type = REG_DWORD; /* only show the publish check box if we are a @@ -2449,7 +2449,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!StrCaseCmp(value, "DNSMachineName")) { + if (!strcasecmp_m(value, "DNSMachineName")) { const char *hostname = get_mydnsfullname(); if (!hostname) { diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 5702a0e8d71..1c7363299ac 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -433,7 +433,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, "rpc_server", name, "embedded"); - if (StrCaseCmp(rpcsrv_type, "embedded") != 0) { + if (strcasecmp_m(rpcsrv_type, "embedded") != 0) { external = true; } -- cgit From 7ab9e26b601e4e51736ce6eace46e6588fa1148f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 18 May 2011 12:10:42 +0200 Subject: s3-epmapper: Fixed endpoint registration. Autobuild-User: Andreas Schneider Autobuild-Date: Fri May 20 12:03:18 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_ep_setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 2dc54bd812c..918bcd43f74 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -133,7 +133,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, const struct ndr_interface_table *iface, - const char *name, + const char *ncalrpc, uint16_t port, struct dcerpc_binding_handle **pbh); @@ -256,7 +256,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, const struct ndr_interface_table *iface, - const char *name, + const char *ncalrpc, uint16_t port, struct dcerpc_binding_handle **pbh) { @@ -266,7 +266,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, status = dcerpc_binding_vector_create(mem_ctx, iface, port, - name, + ncalrpc, &v); if (!NT_STATUS_IS_OK(status)) { return status; @@ -276,7 +276,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, iface, v, &iface->syntax_id.uuid, - name, + iface->name, pbh); talloc_free(v); if (!NT_STATUS_IS_OK(status)) { -- cgit From 309a8fd7c62e7008b1a4c4c77c3a9ea35ed4bb07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 23 May 2011 17:14:47 -0700 Subject: Fix bug #7054 - X account flag does not work when pwdlastset is 0. Don't allow pass_last_set_time to be set to zero (which means "user must change password on next logon") if user object doesn't allow password change. Don't automatically allow user object password change if "user must change password on next logon" is set. Jim please check. Jeremy. --- source3/rpc_server/samr/srv_samr_util.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/samr/srv_samr_util.c b/source3/rpc_server/samr/srv_samr_util.c index 29123321f86..d052846b2e5 100644 --- a/source3/rpc_server/samr/srv_samr_util.c +++ b/source3/rpc_server/samr/srv_samr_util.c @@ -612,7 +612,16 @@ void copy_id21_to_sam_passwd(const char *log_prefix, DEBUG(10,("%s SAMR_FIELD_EXPIRED_FLAG: %02X\n", l, from->password_expired)); if (from->password_expired != 0) { - pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); + /* Only allow the set_time to zero (which means + "User Must Change Password on Next Login" + if the user object allows password change. */ + if (pdb_get_pass_can_change(to)) { + pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); + } else { + DEBUG(10,("%s Disallowing set of 'User Must " + "Change Password on Next Login' as " + "user object disallows this.\n", l)); + } } else { /* A subtlety here: some windows commands will clear the expired flag even though it's not -- cgit From 0f8018676a6cb33238d506338d4fbb8b683550d3 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Fri, 20 May 2011 08:12:08 +0000 Subject: Fix numerous missing dependencies in WAF build scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the recent consolidation of code between s3 and s4, a number of new dependencies have been implicitly introduced. For example, previous s3 code gained an implicit dependency on talloc after the charset related consolidation (lib/util/charset/charset.h now includes talloc.h). When building against the embedded version of talloc this isn't a problem since the paths are automatically added to the search path, but when building against the external libraries build failures will occur for all components that don't directly or indirectly include talloc as a dependency. Since charset.h is included from util.h, which in turn is included from includes.h, this means most of the codebase (s3 and s4) has such an undeclared dependency. Therefore, samba-util-common and samba-util have been added as dependencies to the s3 and s4 code respectively, for all cases where the source would otherwise fail to build. Additionally, a few other dependencies are added in specific wscript_build files to address similar dependency-related problems. https://bugzilla.samba.org/show_bug.cgi?id=8128 Signed-off-by: Sean Finney Signed-off-by: Matthias Dieter Wallnöfer Signed-off-by: Andrew Bartlett Autobuild-User: Matthias Dieter Wallnöfer Autobuild-Date: Wed May 25 19:22:13 CEST 2011 on sn-devel-104 --- source3/rpc_server/wscript_build | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index dec837842fc..eba52a1b258 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -30,23 +30,28 @@ bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', deps='auth_sam_reply RPC_PIPE_REGISTER AUTH_COMMON npa_tstream') bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', - source='rpc_server.c') + source='rpc_server.c', + deps='samba-util-common') bld.SAMBA3_SUBSYSTEM('RPC_CRYPTO', source='dcesrv_ntlmssp.c dcesrv_gssapi.c dcesrv_spnego.c', deps = 'KRB5_PAC') bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER', - source='srv_pipe_register.c') + source='srv_pipe_register.c', + deps='samba-util-common') bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER', - source='rpc_ep_setup.c ../librpc/rpc/dcerpc_ep.c') + source='rpc_ep_setup.c ../librpc/rpc/dcerpc_ep.c', + deps='samba-util-common') bld.SAMBA3_SUBSYSTEM('EPMD', - source='epmd.c') + source='epmd.c', + deps='samba-util-common') bld.SAMBA3_SUBSYSTEM('SRV_ACCESS_CHECK', - source='srv_access_check.c') + source='srv_access_check.c', + deps='samba-util-common') bld.SAMBA3_SUBSYSTEM('RPC_SAMR', source=RPC_SAMR_SRC, @@ -65,10 +70,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_WINREG', bld.SAMBA3_SUBSYSTEM('RPC_INITSHUTDOWN', source=RPC_INITSHUTDOWN_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_DSSETUP', source=RPC_DSSETUP_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_WKSSVC', @@ -83,6 +90,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SVCCTL', bld.SAMBA3_SUBSYSTEM('RPC_NTSVCS', source=RPC_NTSVCS_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_NETLOGON', @@ -92,10 +100,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_NETLOGON', bld.SAMBA3_SUBSYSTEM('RPC_NETDFS', source=RPC_NETDFS_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SRVSVC', source=RPC_SRVSVC_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SPOOLSS', @@ -110,10 +120,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_EVENTLOG', bld.SAMBA3_SUBSYSTEM('RPC_RPCECHO', source=RPC_RPCECHO_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_EPMAPPER', source=RPC_EPMAPPER_SRC, + deps='samba-util-common', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SERVER', -- cgit From 8524924a460349a9aa56db475d771b8884fbe517 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 May 2011 13:00:22 +1000 Subject: s3-smbd provide struct smbd_server_connection * to conn_snum_used This provides the 'sconn' parameter to this key functions, that is currently duplicated in dummysmbd.c, which causes duplicate symbol issues in the waf build. This has natrually caused a number of consequential changes across the codebase, includning not passing a messaging context into initial reload_services(): This causes problems because the global smbd_server_connection isn't yet set up, as there isn't a connection here, just the initial process. Andrew Bartlett --- source3/rpc_server/dfs/srv_dfs_nt.c | 4 +++- source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 + source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 324af534c9b..6ca35a5dcc9 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -26,6 +26,7 @@ #include "../librpc/gen_ndr/srv_dfs.h" #include "msdfs.h" #include "smbd/smbd.h" +#include "smbd/globals.h" #include "auth.h" #undef DBGC_CLASS @@ -278,7 +279,8 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) size_t i; TALLOC_CTX *ctx = talloc_tos(); - jn = enum_msdfs_links(ctx, &num_jn); + jn = enum_msdfs_links(msg_ctx_to_sconn(p->msg_ctx), + ctx, &num_jn); if (!jn || num_jn == 0) { num_jn = 0; jn = NULL; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index fce4fd8648c..f7fa189af5d 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -47,6 +47,7 @@ #include "serverid.h" #include "../libcli/registry/util_reg.h" #include "smbd/smbd.h" +#include "smbd/globals.h" #include "auth.h" #include "messages.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 472a31860e5..7251d70dd98 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -33,6 +33,7 @@ #include "session.h" #include "../lib/util/util_pw.h" #include "smbd/smbd.h" +#include "smbd/globals.h" #include "auth.h" #include "messages.h" @@ -568,7 +569,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, /* Ensure all the usershares are loaded. */ become_root(); - load_usershare_shares(); + load_usershare_shares(msg_ctx_to_sconn(p->msg_ctx)); load_registry_shares(); num_services = lp_numservices(); unbecome_root(); -- cgit From 381423b1bdba4c7d1931b162d872134c42e432cf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 30 May 2011 13:23:56 +1000 Subject: libcli/security: move secdesc.c to the top level libcli/security This code does not rely on lp_ or other source3 only functions, so can be part of the common library. Andrew Bartlett --- source3/rpc_server/winreg/srv_winreg_nt.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c index 1b3cab88447..6f319e99054 100644 --- a/source3/rpc_server/winreg/srv_winreg_nt.c +++ b/source3/rpc_server/winreg/srv_winreg_nt.c @@ -30,6 +30,7 @@ #include "rpc_misc.h" #include "auth.h" #include "lib/privileges.h" +#include "libcli/security/secdesc.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -- cgit From 942ae874b85570f44b3257c8d229792ede7f8fd9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 31 May 2011 13:24:24 +0200 Subject: s3:rpc_server: add GPL/Copyright header to rpc_server/srv_access_check.h --- source3/rpc_server/srv_access_check.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_access_check.h b/source3/rpc_server/srv_access_check.h index 27a09bd0074..db25ed65a47 100644 --- a/source3/rpc_server/srv_access_check.h +++ b/source3/rpc_server/srv_access_check.h @@ -1,3 +1,32 @@ +/* + * 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) Marc Jacobsen 1999, + * Copyright (C) Jeremy Allison 2001-2008, + * Copyright (C) Jean François Micouleau 1998-2001, + * Copyright (C) Jim McDonough 2002, + * Copyright (C) Gerald (Jerry) Carter 2003-2004, + * Copyright (C) Simo Sorce 2003. + * Copyright (C) Volker Lendecke 2005. + * 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 . + */ + /* The following definitions come from rpc_server/srv_access_check.c */ NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token, -- cgit From e40331552137f513c6c2404d96adcf421212ec86 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 31 May 2011 13:25:34 +0200 Subject: s3:rpc_server: add _RPC_SERVER_SRV_ACCESS_CHECK_H_ guard to srv_access_check.h --- source3/rpc_server/srv_access_check.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_access_check.h b/source3/rpc_server/srv_access_check.h index db25ed65a47..72ce539568e 100644 --- a/source3/rpc_server/srv_access_check.h +++ b/source3/rpc_server/srv_access_check.h @@ -27,6 +27,9 @@ * along with this program; if not, see . */ +#ifndef _RPC_SERVER_SRV_ACCESS_CHECK_H_ +#define _RPC_SERVER_SRV_ACCESS_CHECK_H_ + /* The following definitions come from rpc_server/srv_access_check.c */ NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token, @@ -37,3 +40,5 @@ NTSTATUS access_check_object( struct security_descriptor *psd, struct security_t void map_max_allowed_access(const struct security_token *nt_token, const struct security_unix_token *unix_token, uint32_t *pacc_requested); + +#endif /* _RPC_SERVER_SRV_ACCESS_CHECK_H_ */ -- cgit From f103e0c39f9f93b765a9cdb93a7600a1f6f06315 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 31 May 2011 13:24:09 +0200 Subject: s3: fix more -Wunused-but-set-variable build warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guenther Autobuild-User: Günther Deschner Autobuild-Date: Wed Jun 1 00:29:30 CEST 2011 on sn-devel-104 --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index f7fa189af5d..52e4ab0a724 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -4179,10 +4179,9 @@ static WERROR construct_printer_info6(TALLOC_CTX *mem_ctx, struct spoolss_PrinterInfo6 *r, int snum) { - int count; print_status_struct status; - count = print_queue_length(msg_ctx, snum, &status); + print_queue_length(msg_ctx, snum, &status); r->status = nt_printq_status(status.status); -- cgit From e39e09ffb5baa527b03454c905ccd1292fa9c93f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 25 May 2011 16:03:43 +0200 Subject: s3-rpc_server: Store the ndr syntax id in the pipe context. The client tell us in the rpc bind to which rpc service it wants to connect. We did set the p->syntax earlier by guessing to which pipe name it connects, but we don't know to which rpc service it wants to bind until we read the first packet. --- source3/rpc_server/srv_pipe.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 72c8f809593..a6e43b65ec0 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -331,19 +331,19 @@ bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS fault_status) static bool check_bind_req(struct pipes_struct *p, struct ndr_syntax_id* abstract, struct ndr_syntax_id* transfer, - uint32 context_id) + uint32_t context_id) { struct pipe_rpc_fns *context_fns; DEBUG(3,("check_bind_req for %s\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + get_pipe_name_from_syntax(talloc_tos(), abstract))); /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */ if (rpc_srv_pipe_exists_by_id(abstract) && ndr_syntax_id_equal(transfer, &ndr_transfer_syntax)) { - DEBUG(3, ("check_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n", - rpc_srv_get_pipe_cli_name(abstract), - rpc_srv_get_pipe_srv_name(abstract))); + DEBUG(3, ("check_bind_req: %s -> %s rpc service\n", + rpc_srv_get_pipe_cli_name(abstract), + rpc_srv_get_pipe_srv_name(abstract))); } else { return false; } @@ -358,6 +358,7 @@ static bool check_bind_req(struct pipes_struct *p, context_fns->n_cmds = rpc_srv_get_pipe_num_cmds(abstract); context_fns->cmds = rpc_srv_get_pipe_cmds(abstract); context_fns->context_id = context_id; + context_fns->syntax = *abstract; /* add to the list of open contexts */ -- cgit From 34a600a27f5b288a9185b6d32c7252b9f5a81a09 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 10:28:39 +0200 Subject: s3-rpc_server: Move the context functions to own file. --- source3/rpc_server/rpc_contexts.c | 40 +++++++++++++++++++++++++++++++++++++++ source3/rpc_server/rpc_contexts.h | 28 +++++++++++++++++++++++++++ source3/rpc_server/srv_pipe.c | 21 +------------------- source3/rpc_server/wscript_build | 2 +- 4 files changed, 70 insertions(+), 21 deletions(-) create mode 100644 source3/rpc_server/rpc_contexts.c create mode 100644 source3/rpc_server/rpc_contexts.h (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_contexts.c b/source3/rpc_server/rpc_contexts.c new file mode 100644 index 00000000000..bb5c0eaf6cd --- /dev/null +++ b/source3/rpc_server/rpc_contexts.c @@ -0,0 +1,40 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * 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 "ntdomain.h" + +#include "rpc_contexts.h" + +struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list, + uint32_t context_id) +{ + struct pipe_rpc_fns *fns = NULL; + + if ( !list ) { + DEBUG(0,("find_pipe_fns_by_context: ERROR! No context list for pipe!\n")); + return NULL; + } + + for (fns=list; fns; fns=fns->next ) { + if ( fns->context_id == context_id ) + return fns; + } + return NULL; +} diff --git a/source3/rpc_server/rpc_contexts.h b/source3/rpc_server/rpc_contexts.h new file mode 100644 index 00000000000..8463414bbb3 --- /dev/null +++ b/source3/rpc_server/rpc_contexts.h @@ -0,0 +1,28 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * 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 . + */ + +#ifndef _RPC_SERVER_RPC_CONTEXTS_H_ +#define _RPC_SERVER_RPC_CONTEXTS_H_ + +struct pipe_rpc_fns; + +struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list, + uint32_t context_id); + +#endif /* _RPC_SERVER_RPC_CONTEXTS_H_*/ diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index a6e43b65ec0..1af8cdac071 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -42,6 +42,7 @@ #include "auth.h" #include "ntdomain.h" #include "rpc_server/srv_pipe.h" +#include "rpc_server/rpc_contexts.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV @@ -1509,26 +1510,6 @@ static bool api_pipe_alter_context(struct pipes_struct *p, return setup_bind_nak(p, pkt); } -/**************************************************************************** - Find the set of RPC functions associated with this context_id -****************************************************************************/ - -static PIPE_RPC_FNS* find_pipe_fns_by_context( PIPE_RPC_FNS *list, uint32 context_id ) -{ - PIPE_RPC_FNS *fns = NULL; - - if ( !list ) { - DEBUG(0,("find_pipe_fns_by_context: ERROR! No context list for pipe!\n")); - return NULL; - } - - for (fns=list; fns; fns=fns->next ) { - if ( fns->context_id == context_id ) - return fns; - } - return NULL; -} - static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, const struct api_struct *api_rpc_cmds, int n_cmds); diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index eba52a1b258..0e557a4bb75 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -26,7 +26,7 @@ bld.SAMBA3_SUBSYSTEM('rpc', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', - source='rpc_ncacn_np.c rpc_handles.c', + source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c', deps='auth_sam_reply RPC_PIPE_REGISTER AUTH_COMMON npa_tstream') bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', -- cgit From 6e8c7d08344158714041bbe5b344b453d8b7c225 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 13:33:05 +0200 Subject: s3-rpc_server: Use the correct context syntax. --- source3/rpc_server/rpc_ncacn_np.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 36ee3038e57..fddd876f5af 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -33,6 +33,7 @@ #include "ntdomain.h" #include "../lib/tsocket/tsocket.h" #include "../lib/util/tevent_ntstatus.h" +#include "rpc_contexts.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV @@ -127,6 +128,7 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, struct messaging_context *msg_ctx) { struct pipes_struct *p; + struct pipe_rpc_fns *context_fns; DEBUG(4,("Create pipe requested %s\n", get_pipe_name_from_syntax(talloc_tos(), syntax))); @@ -172,6 +174,21 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, p->syntax = *syntax; p->transport = NCALRPC; + context_fns = SMB_MALLOC_P(struct pipe_rpc_fns); + if (context_fns == NULL) { + DEBUG(0,("malloc() failed!\n")); + return False; + } + + context_fns->next = context_fns->prev = NULL; + context_fns->n_cmds = rpc_srv_get_pipe_num_cmds(syntax); + context_fns->cmds = rpc_srv_get_pipe_cmds(syntax); + context_fns->context_id = 0; + context_fns->syntax = *syntax; + + /* add to the list of open contexts */ + DLIST_ADD(p->contexts, context_fns); + DEBUG(4,("Created internal pipe %s (pipes_open=%d)\n", get_pipe_name_from_syntax(talloc_tos(), syntax), pipes_open)); @@ -186,8 +203,9 @@ static NTSTATUS rpcint_dispatch(struct pipes_struct *p, const DATA_BLOB *in_data, DATA_BLOB *out_data) { - uint32_t num_cmds = rpc_srv_get_pipe_num_cmds(&p->syntax); - const struct api_struct *cmds = rpc_srv_get_pipe_cmds(&p->syntax); + struct pipe_rpc_fns *fns = find_pipe_fns_by_context(p->contexts, 0); + uint32_t num_cmds = fns->n_cmds; + const struct api_struct *cmds = fns->cmds; uint32_t i; bool ok; -- cgit From c8ec695cb3646c9f38a8a54171a2bdac2b1fd5a5 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 25 May 2011 16:58:18 +0200 Subject: s3-rpc_server: Use the correct syntax id in api_pipe_bind_req(). --- source3/rpc_server/srv_pipe.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 1af8cdac071..2f1709da8bb 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -857,9 +857,7 @@ static bool api_pipe_bind_req(struct pipes_struct *p, /* No rebinds on a bound pipe - use alter context. */ if (p->pipe_bound) { - DEBUG(2,("api_pipe_bind_req: rejecting bind request on bound " - "pipe %s.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + DEBUG(2,("Rejecting bind request on bound rpc connection\n")); return setup_bind_nak(p, pkt); } @@ -874,38 +872,35 @@ static bool api_pipe_bind_req(struct pipes_struct *p, */ id = pkt->u.bind.ctx_list[0].abstract_syntax; if (rpc_srv_pipe_exists_by_id(&id)) { - DEBUG(3, ("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n", - rpc_srv_get_pipe_cli_name(&id), - rpc_srv_get_pipe_srv_name(&id))); + DEBUG(3, ("api_pipe_bind_req: %s -> %s rpc service\n", + rpc_srv_get_pipe_cli_name(&id), + rpc_srv_get_pipe_srv_name(&id))); } else { status = smb_probe_module( "rpc", get_pipe_name_from_syntax( talloc_tos(), - &pkt->u.bind.ctx_list[0].abstract_syntax)); + &id)); if (NT_STATUS_IS_ERR(status)) { - DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n", - get_pipe_name_from_syntax( - talloc_tos(), - &pkt->u.bind.ctx_list[0].abstract_syntax))); + DEBUG(3,("api_pipe_bind_req: Unknown rpc service name " + "%s in bind request.\n", + get_pipe_name_from_syntax(talloc_tos(), &id))); return setup_bind_nak(p, pkt); } if (rpc_srv_get_pipe_interface_by_cli_name( get_pipe_name_from_syntax(talloc_tos(), - &p->syntax), + &id), &id)) { - DEBUG(3, ("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n", - rpc_srv_get_pipe_cli_name(&id), - rpc_srv_get_pipe_srv_name(&id))); + DEBUG(3, ("api_pipe_bind_req: %s -> %s rpc service\n", + rpc_srv_get_pipe_cli_name(&id), + rpc_srv_get_pipe_srv_name(&id))); } else { DEBUG(0, ("module %s doesn't provide functions for " "pipe %s!\n", - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax), - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + get_pipe_name_from_syntax(talloc_tos(), &id), + get_pipe_name_from_syntax(talloc_tos(), &id))); return setup_bind_nak(p, pkt); } } -- cgit From 58485afd91dde993cd7f14ca0182f661be4b719c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 30 May 2011 11:02:47 +0200 Subject: s3-rpc_server: Use the context syntax id in api_pipe_request(). --- source3/rpc_server/srv_pipe.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 2f1709da8bb..80267e0d716 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -1532,9 +1532,6 @@ static bool api_pipe_request(struct pipes_struct *p, changed_user = True; } - DEBUG(5, ("Requested \\PIPE\\%s\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); - /* get the set of RPC functions for this context */ pipe_fns = find_pipe_fns_by_context(p->contexts, @@ -1542,15 +1539,18 @@ static bool api_pipe_request(struct pipes_struct *p, if ( pipe_fns ) { TALLOC_CTX *frame = talloc_stackframe(); + + DEBUG(5, ("Requested %s rpc service\n", + get_pipe_name_from_syntax(talloc_tos(), &pipe_fns->syntax))); + ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds); + TALLOC_FREE(frame); } else { DEBUG(0, ("No rpc function table associated with context " - "[%d] on pipe [%s]\n", - pkt->u.request.context_id, - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + "[%d]\n", + pkt->u.request.context_id)); } if (changed_user) { -- cgit From 6b0f82eeab04e59657231b73fd94d33cffaadc76 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 10:53:55 +0200 Subject: s3-rpc_server: Migrate init_pipe_handles() to new syntax. --- source3/rpc_server/rpc_handles.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 493149b2c3b..32e98f3644f 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -84,15 +84,28 @@ bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *synta for (plist = get_first_internal_pipe(); plist; plist = get_next_internal_pipe(plist)) { - if (ndr_syntax_id_equal(syntax, &plist->syntax)) { - break; + struct pipe_rpc_fns *p_ctx; + bool stop = false; + + for (p_ctx = plist->contexts; + p_ctx != NULL; + p_ctx = p_ctx->next) { + if (ndr_syntax_id_equal(syntax, &p_ctx->syntax)) { + stop = true; + break; + } + if (is_samr_lsa_pipe(&p_ctx->syntax) + && is_samr_lsa_pipe(syntax)) { + /* + * samr and lsa share a handle space (same process + * under Windows?) + */ + stop = true; + break; + } } - if (is_samr_lsa_pipe(&plist->syntax) - && is_samr_lsa_pipe(syntax)) { - /* - * samr and lsa share a handle space (same process - * under Windows?) - */ + + if (stop) { break; } } -- cgit From 7d800a8694e7c9bef96ae006ace5807872f375d4 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 30 May 2011 11:11:48 +0200 Subject: s3-rpc_server: Use the correct syntax id for debugging. --- source3/rpc_server/srv_pipe.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 80267e0d716..6e48fedd2b7 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -1506,7 +1506,8 @@ static bool api_pipe_alter_context(struct pipes_struct *p, } static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, - const struct api_struct *api_rpc_cmds, int n_cmds); + const struct api_struct *api_rpc_cmds, int n_cmds, + const struct ndr_syntax_id *syntax); /**************************************************************************** Find the correct RPC function to call for this request. @@ -1543,7 +1544,8 @@ static bool api_pipe_request(struct pipes_struct *p, DEBUG(5, ("Requested %s rpc service\n", get_pipe_name_from_syntax(talloc_tos(), &pipe_fns->syntax))); - ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds); + ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds, + &pipe_fns->syntax); TALLOC_FREE(frame); } @@ -1565,20 +1567,21 @@ static bool api_pipe_request(struct pipes_struct *p, ********************************************************************/ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, - const struct api_struct *api_rpc_cmds, int n_cmds) + const struct api_struct *api_rpc_cmds, int n_cmds, + const struct ndr_syntax_id *syntax) { int fn_num; uint32_t offset1; /* interpret the command */ DEBUG(4,("api_rpcTNP: %s op 0x%x - ", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), syntax), pkt->u.request.opnum)); if (DEBUGLEVEL >= 50) { fstring name; slprintf(name, sizeof(name)-1, "in_%s", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)); + get_pipe_name_from_syntax(talloc_tos(), syntax)); dump_pdu_region(name, pkt->u.request.opnum, &p->in_data.data, 0, p->in_data.data.length); @@ -1611,7 +1614,7 @@ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, /* do the actual command */ if(!api_rpc_cmds[fn_num].fn(p)) { DEBUG(0,("api_rpcTNP: %s: %s failed.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), syntax), api_rpc_cmds[fn_num].name)); data_blob_free(&p->out_data.rdata); return False; @@ -1634,14 +1637,14 @@ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, if (DEBUGLEVEL >= 50) { fstring name; slprintf(name, sizeof(name)-1, "out_%s", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax)); + get_pipe_name_from_syntax(talloc_tos(), syntax)); dump_pdu_region(name, pkt->u.request.opnum, &p->out_data.rdata, offset1, p->out_data.rdata.length); } DEBUG(5,("api_rpcTNP: called %s successfully\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + get_pipe_name_from_syntax(talloc_tos(), syntax))); /* Check for buffer underflow in rpc parsing */ if ((DEBUGLEVEL >= 10) && -- cgit From 438b24a77f5173d9ffee76009589033ece6e9dce Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 25 May 2011 17:26:01 +0200 Subject: s3-rpc_server: Remove guessing of the syntax id. This is only a wild guess. We don't know to which rpc service the client wants to talk until we read the the rpc bind packet. --- source3/rpc_server/epmd.c | 3 --- source3/rpc_server/rpc_ep_setup.c | 10 ---------- source3/rpc_server/rpc_server.c | 40 ++++----------------------------------- source3/rpc_server/rpc_server.h | 2 -- source3/rpc_server/srv_pipe.c | 7 +++++++ 5 files changed, 11 insertions(+), 51 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index 4e2056e5068..81ebc46a9db 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -54,7 +54,6 @@ static bool epmd_open_sockets(struct tevent_context *ev_ctx, port = setup_dcerpc_ncacn_tcpip_socket(ev_ctx, msg_ctx, - ndr_table_epmapper.syntax_id, ifss, 135); if (port == 0) { @@ -89,7 +88,6 @@ static bool epmd_open_sockets(struct tevent_context *ev_ctx, port = setup_dcerpc_ncacn_tcpip_socket(ev_ctx, msg_ctx, - ndr_table_epmapper.syntax_id, &ss, 135); if (port == 0) { @@ -263,7 +261,6 @@ void start_epmd(struct tevent_context *ev_ctx, ok = setup_dcerpc_ncalrpc_socket(ev_ctx, msg_ctx, - ndr_table_epmapper.syntax_id, "EPMAPPER", srv_epmapper_delete_endpoints); if (!ok) { diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 918bcd43f74..3ed2f0dc9d2 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -79,7 +79,6 @@ static uint16_t _open_sockets(struct tevent_context *ev_ctx, p = setup_dcerpc_ncacn_tcpip_socket(ev_ctx, msg_ctx, - syntax_id, ifss, port); if (p == 0) { @@ -115,7 +114,6 @@ static uint16_t _open_sockets(struct tevent_context *ev_ctx, p = setup_dcerpc_ncacn_tcpip_socket(ev_ctx, msg_ctx, - syntax_id, &ss, port); if (p == 0) { @@ -430,7 +428,6 @@ static bool winreg_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -478,7 +475,6 @@ static bool srvsvc_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -527,7 +523,6 @@ static bool lsarpc_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -576,7 +571,6 @@ static bool samr_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -625,7 +619,6 @@ static bool netlogon_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -890,7 +883,6 @@ static bool netdfs_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -939,7 +931,6 @@ static bool dssetup_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { @@ -987,7 +978,6 @@ static bool wkssvc_init_cb(void *ptr) ok = setup_dcerpc_ncalrpc_socket(ep_ctx->ev_ctx, ep_ctx->msg_ctx, - abstract_syntax, pipe_name, NULL); if (!ok) { diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 3f81a2ff386..064fba3b040 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -79,7 +79,6 @@ static NTSTATUS auth_anonymous_session_info(TALLOC_CTX *mem_ctx, * sent from the client */ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, const char *pipe_name, - const struct ndr_syntax_id id, enum dcerpc_transport_t transport, bool ncalrpc_as_system, const char *client_address, @@ -93,14 +92,14 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, struct pipes_struct *p; struct auth_serversupplied_info *server_info; NTSTATUS status; - bool ok; p = talloc_zero(mem_ctx, struct pipes_struct); if (!p) { *perrno = ENOMEM; return -1; } - p->syntax = id; + + p->syntax = null_ndr_syntax_id; p->transport = transport; p->ncalrpc_as_system = ncalrpc_as_system; @@ -111,15 +110,6 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, return -1; } - ok = init_pipe_handles(p, &id); - if (!ok) { - DEBUG(1, ("Failed to init handles\n")); - TALLOC_FREE(p); - *perrno = EINVAL; - return -1; - } - - data_blob_free(&p->in_data.data); data_blob_free(&p->in_data.pdu); @@ -354,7 +344,6 @@ static void named_pipe_listener(struct tevent_context *ev, struct named_pipe_client { const char *pipe_name; - struct ndr_syntax_id pipe_id; struct tevent_context *ev; struct messaging_context *msg_ctx; @@ -383,20 +372,11 @@ static void named_pipe_accept_done(struct tevent_req *subreq); static void named_pipe_accept_function(const char *pipe_name, int fd) { - struct ndr_syntax_id syntax; struct named_pipe_client *npc; struct tstream_context *plain; struct tevent_req *subreq; - bool ok; int ret; - ok = is_known_pipename(pipe_name, &syntax); - if (!ok) { - DEBUG(1, ("Unknown pipe [%s]\n", pipe_name)); - close(fd); - return; - } - npc = talloc_zero(NULL, struct named_pipe_client); if (!npc) { DEBUG(0, ("Out of memory!\n")); @@ -404,7 +384,6 @@ static void named_pipe_accept_function(const char *pipe_name, int fd) return; } npc->pipe_name = pipe_name; - npc->pipe_id = syntax; npc->ev = server_event_context(); npc->msg_ctx = server_messaging_context(); @@ -484,7 +463,7 @@ static void named_pipe_accept_done(struct tevent_req *subreq) } ret = make_server_pipes_struct(npc, - npc->pipe_name, npc->pipe_id, NCACN_NP, + npc->pipe_name, NCACN_NP, false, cli_addr, NULL, npc->session_info, &npc->p, &error); if (ret != 0) { @@ -693,7 +672,6 @@ fail: static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, enum dcerpc_transport_t transport, const char *name, uint16_t port, @@ -713,7 +691,6 @@ static void dcerpc_ncacn_tcpip_listener(struct tevent_context *ev, uint16_t setup_dcerpc_ncacn_tcpip_socket(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, const struct sockaddr_storage *ifss, uint16_t port) { @@ -727,7 +704,6 @@ uint16_t setup_dcerpc_ncacn_tcpip_socket(struct tevent_context *ev_ctx, return 0; } - state->syntax_id = syntax_id; state->fd = -1; state->ep.port = port; state->disconnect_fn = NULL; @@ -853,7 +829,6 @@ static void dcerpc_ncacn_tcpip_listener(struct tevent_context *ev, dcerpc_ncacn_accept(state->ev_ctx, state->msg_ctx, - state->syntax_id, NCACN_IP_TCP, NULL, state->ep.port, @@ -874,7 +849,6 @@ static void dcerpc_ncalrpc_listener(struct tevent_context *ev, bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, const char *name, dcerpc_ncacn_disconnect_fn fn) { @@ -887,7 +861,6 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, return false; } - state->syntax_id = syntax_id; state->fd = -1; state->disconnect_fn = fn; @@ -983,15 +956,13 @@ static void dcerpc_ncalrpc_listener(struct tevent_context *ev, dcerpc_ncacn_accept(state->ev_ctx, state->msg_ctx, - state->syntax_id, NCALRPC, + NCALRPC, state->ep.name, 0, cli_addr, NULL, sd, state->disconnect_fn); } struct dcerpc_ncacn_conn { - struct ndr_syntax_id syntax_id; - enum dcerpc_transport_t transport; union { @@ -1025,7 +996,6 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq); static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, enum dcerpc_transport_t transport, const char *name, uint16_t port, @@ -1054,7 +1024,6 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, } ncacn_conn->transport = transport; - ncacn_conn->syntax_id = syntax_id; ncacn_conn->ev_ctx = ev_ctx; ncacn_conn->msg_ctx = msg_ctx; ncacn_conn->sock = s; @@ -1185,7 +1154,6 @@ static void dcerpc_ncacn_accept(struct tevent_context *ev_ctx, rc = make_server_pipes_struct(ncacn_conn, pipe_name, - ncacn_conn->syntax_id, ncacn_conn->transport, system_user, cli_str, diff --git a/source3/rpc_server/rpc_server.h b/source3/rpc_server/rpc_server.h index 41d508c6dc0..aafc96238a5 100644 --- a/source3/rpc_server/rpc_server.h +++ b/source3/rpc_server/rpc_server.h @@ -31,13 +31,11 @@ bool setup_named_pipe_socket(const char *pipe_name, uint16_t setup_dcerpc_ncacn_tcpip_socket(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, const struct sockaddr_storage *ifss, uint16_t port); bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx, - struct ndr_syntax_id syntax_id, const char *name, dcerpc_ncacn_disconnect_fn fn); diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 6e48fedd2b7..878f5d07922 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -335,6 +335,7 @@ static bool check_bind_req(struct pipes_struct *p, uint32_t context_id) { struct pipe_rpc_fns *context_fns; + bool ok; DEBUG(3,("check_bind_req for %s\n", get_pipe_name_from_syntax(talloc_tos(), abstract))); @@ -349,6 +350,12 @@ static bool check_bind_req(struct pipes_struct *p, return false; } + ok = init_pipe_handles(p, abstract); + if (!ok) { + DEBUG(1, ("Failed to init pipe handles!\n")); + return false; + } + context_fns = SMB_MALLOC_P(struct pipe_rpc_fns); if (context_fns == NULL) { DEBUG(0,("check_bind_req: malloc() failed!\n")); -- cgit From e744222e41b7c4c9b197641d3c5c87b27daf5ce8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 25 May 2011 17:26:28 +0200 Subject: s3-rpc_server: Don't segfault if there are not handles to free. --- source3/rpc_server/rpc_handles.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 32e98f3644f..1d78af8170d 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -307,6 +307,10 @@ bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd) void close_policy_by_pipe(struct pipes_struct *p) { + if (p->pipe_handles == NULL) { + return; + } + p->pipe_handles->pipe_ref_count--; if (p->pipe_handles->pipe_ref_count == 0) { -- cgit From 89ced2cc49971557b23b8ae8fb804e16bed8cb6c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 30 May 2011 11:27:07 +0200 Subject: s3-rpc_server: Fix debug messages. --- source3/rpc_server/srv_pipe.c | 66 +++++++++++++------------------------------ 1 file changed, 20 insertions(+), 46 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 878f5d07922..fc08d56b1e9 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -625,14 +625,12 @@ static bool pipe_ntlmssp_verify_final(TALLOC_CTX *mem_ctx, struct auth_ntlmssp_state *ntlmssp_ctx, enum dcerpc_AuthLevel auth_level, struct client_address *client_id, - struct ndr_syntax_id *syntax, struct auth_serversupplied_info **session_info) { NTSTATUS status; bool ret; - DEBUG(5, (__location__ ": pipe %s checking user details\n", - get_pipe_name_from_syntax(talloc_tos(), syntax))); + DEBUG(5, (__location__ ": checking user details\n")); /* Finally - if the pipe negotiated integrity (sign) or privacy (seal) ensure the underlying NTLMSSP flags are also set. If not we should @@ -645,8 +643,7 @@ static bool pipe_ntlmssp_verify_final(TALLOC_CTX *mem_ctx, DCERPC_AUTH_LEVEL_PRIVACY)); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, (__location__ ": Client failed to negotatie proper " - "security for pipe %s\n", - get_pipe_name_from_syntax(talloc_tos(), syntax))); + "security for rpc connection\n")); return false; } @@ -777,7 +774,7 @@ static NTSTATUS pipe_auth_verify_final(struct pipes_struct *p) struct auth_ntlmssp_state); if (!pipe_ntlmssp_verify_final(p, ntlmssp_ctx, p->auth.auth_level, - p->client_id, &p->syntax, + p->client_id, &p->session_info)) { return NT_STATUS_ACCESS_DENIED; } @@ -823,7 +820,6 @@ static NTSTATUS pipe_auth_verify_final(struct pipes_struct *p) if (!pipe_ntlmssp_verify_final(p, ntlmssp_ctx, p->auth.auth_level, p->client_id, - &p->syntax, &p->session_info)) { return NT_STATUS_ACCESS_DENIED; } @@ -1694,8 +1690,8 @@ void set_incoming_fault(struct pipes_struct *p) p->in_data.pdu_needed_len = 0; p->in_data.pdu.length = 0; p->fault_state = True; - DEBUG(10, ("set_incoming_fault: Setting fault state on pipe %s\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + + DEBUG(10, ("Setting fault state\n")); } static NTSTATUS dcesrv_auth_request(struct pipe_auth_data *auth, @@ -1829,8 +1825,7 @@ void process_complete_pdu(struct pipes_struct *p) bool reply = False; if(p->fault_state) { - DEBUG(10,("process_complete_pdu: pipe %s in fault state.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + DEBUG(10,("RPC connection in fault state.\n")); goto done; } @@ -1862,7 +1857,7 @@ void process_complete_pdu(struct pipes_struct *p) /* Store the call_id */ p->call_id = pkt->call_id; - DEBUG(10, ("Processing packet type %d\n", (int)pkt->ptype)); + DEBUG(10, ("Processing packet type %u\n", (unsigned int)pkt->ptype)); switch (pkt->ptype) { case DCERPC_PKT_REQUEST: @@ -1870,19 +1865,12 @@ void process_complete_pdu(struct pipes_struct *p) break; case DCERPC_PKT_PING: /* CL request - ignore... */ - DEBUG(0, ("process_complete_pdu: Error. " - "Connectionless packet type %d received on " - "pipe %s.\n", (int)pkt->ptype, - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - Connectionless packet type %u received\n", + (unsigned int)pkt->ptype)); break; case DCERPC_PKT_RESPONSE: /* No responses here. */ - DEBUG(0, ("process_complete_pdu: Error. " - "DCERPC_PKT_RESPONSE received from client " - "on pipe %s.\n", - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - DCERPC_PKT_RESPONSE received from client")); break; case DCERPC_PKT_FAULT: @@ -1895,11 +1883,8 @@ void process_complete_pdu(struct pipes_struct *p) case DCERPC_PKT_CL_CANCEL: case DCERPC_PKT_FACK: case DCERPC_PKT_CANCEL_ACK: - DEBUG(0, ("process_complete_pdu: Error. " - "Connectionless packet type %u received on " - "pipe %s.\n", (unsigned int)pkt->ptype, - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - Connectionless packet type %u received\n", + (unsigned int)pkt->ptype)); break; case DCERPC_PKT_BIND: @@ -1913,12 +1898,9 @@ void process_complete_pdu(struct pipes_struct *p) case DCERPC_PKT_BIND_ACK: case DCERPC_PKT_BIND_NAK: - DEBUG(0, ("process_complete_pdu: Error. " - "DCERPC_PKT_BINDACK/DCERPC_PKT_BINDNACK " - "packet type %u received on pipe %s.\n", - (unsigned int)pkt->ptype, - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - DCERPC_PKT_BINDACK/DCERPC_PKT_BINDNACK " + "packet type %u received.\n", + (unsigned int)pkt->ptype)); break; @@ -1932,11 +1914,8 @@ void process_complete_pdu(struct pipes_struct *p) break; case DCERPC_PKT_ALTER_RESP: - DEBUG(0, ("process_complete_pdu: Error. " - "DCERPC_PKT_ALTER_RESP on pipe %s: " - "Should only be server -> client.\n", - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - DCERPC_PKT_ALTER_RESP received: " + "Should only be server -> client.\n")); break; case DCERPC_PKT_AUTH3: @@ -1949,11 +1928,8 @@ void process_complete_pdu(struct pipes_struct *p) break; case DCERPC_PKT_SHUTDOWN: - DEBUG(0, ("process_complete_pdu: Error. " - "DCERPC_PKT_SHUTDOWN on pipe %s: " - "Should only be server -> client.\n", - get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(0, ("Error - DCERPC_PKT_SHUTDOWN received: " + "Should only be server -> client.\n")); break; case DCERPC_PKT_CO_CANCEL: @@ -1998,9 +1974,7 @@ void process_complete_pdu(struct pipes_struct *p) done: if (!reply) { - DEBUG(3,("process_complete_pdu: DCE/RPC fault sent on " - "pipe %s\n", get_pipe_name_from_syntax(talloc_tos(), - &p->syntax))); + DEBUG(3,("DCE/RPC fault sent!")); set_incoming_fault(p); setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR)); TALLOC_FREE(pkt); -- cgit From 9f1b20e971ec0760ec2b3699f72daa54073ce656 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 13:32:22 +0200 Subject: s3-rpc_server: Fixed debug messages for rpc_handles. --- source3/rpc_server/rpc_handles.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 1d78af8170d..0b302510e07 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -319,9 +319,9 @@ void close_policy_by_pipe(struct pipes_struct *p) */ TALLOC_FREE(p->pipe_handles); - DEBUG(10,("close_policy_by_pipe: deleted handle list for " - "pipe %s\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + DEBUG(10,("Deleted handle list for RPC connection %s\n", + get_pipe_name_from_syntax(talloc_tos(), + &p->contexts->syntax))); } } @@ -362,9 +362,10 @@ void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd, void *data; if (p->pipe_handles->count > MAX_OPEN_POLS) { - DEBUG(0, ("policy_handle_create: ERROR: too many handles (%d) " - "on pipe %s.\n", (int)p->pipe_handles->count, - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + DEBUG(0, ("ERROR: Too many handles (%d) for RPC connection %s\n", + get_pipe_name_from_syntax(talloc_tos(), + &p->contexts->syntax), + (int) p->pipe_handles->count)); *pstatus = NT_STATUS_INSUFFICIENT_RESOURCES; return NULL; } -- cgit From 751ecd9bf7e3d657cad7de72f396a15357f9d26f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 13:42:52 +0200 Subject: s3-rpc_server: Fixed debug messages of srv_pipe_hnd. --- source3/rpc_server/srv_pipe_hnd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 1c7363299ac..501bb1efc77 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -280,7 +280,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, } DEBUG(6,(" name: %s len: %u\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), &p->contexts->syntax), (unsigned int)n)); /* @@ -298,7 +298,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, DEBUG(5,("read_from_pipe: too large read (%u) requested on " "pipe %s. We can only service %d sized reads.\n", (unsigned int)n, - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), &p->contexts->syntax), RPC_MAX_PDU_FRAG_LEN )); n = RPC_MAX_PDU_FRAG_LEN; } @@ -319,7 +319,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, DEBUG(10,("read_from_pipe: %s: current_pdu_len = %u, " "current_pdu_sent = %u returning %d bytes.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), &p->contexts->syntax), (unsigned int)p->out_data.frag.length, (unsigned int)p->out_data.current_pdu_sent, (int)data_returned)); @@ -340,7 +340,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, DEBUG(10,("read_from_pipe: %s: fault_state = %d : data_sent_length " "= %u, p->out_data.rdata.length = %u.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax), + get_pipe_name_from_syntax(talloc_tos(), &p->contexts->syntax), (int)p->fault_state, (unsigned int)p->out_data.data_sent_length, (unsigned int)p->out_data.rdata.length)); @@ -362,7 +362,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, if(!create_next_pdu(p)) { DEBUG(0,("read_from_pipe: %s: create_next_pdu failed.\n", - get_pipe_name_from_syntax(talloc_tos(), &p->syntax))); + get_pipe_name_from_syntax(talloc_tos(), &p->contexts->syntax))); return -1; } -- cgit From f086057ce89a5a09e26b7b0f85e598951a866851 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 13:37:11 +0200 Subject: s3-rpc_server: Remove syntax from pipes_struct. --- source3/rpc_server/rpc_ncacn_np.c | 1 - source3/rpc_server/rpc_server.c | 1 - 2 files changed, 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index fddd876f5af..cddc9b690f4 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -171,7 +171,6 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, p->endian = RPC_LITTLE_ENDIAN; - p->syntax = *syntax; p->transport = NCALRPC; context_fns = SMB_MALLOC_P(struct pipe_rpc_fns); diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 064fba3b040..44c1b104c0b 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -99,7 +99,6 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx, return -1; } - p->syntax = null_ndr_syntax_id; p->transport = transport; p->ncalrpc_as_system = ncalrpc_as_system; -- cgit From 4640d908f7abd0c0a96e89162adc23d1ee78b71c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 11:35:39 +0200 Subject: s3-rpc_server: Remove unused variable pipes_open. --- source3/rpc_server/rpc_ncacn_np.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index cddc9b690f4..4446578e3f9 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -38,8 +38,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -static int pipes_open; - static struct pipes_struct *InternalPipes; /* TODO @@ -188,8 +186,8 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, /* add to the list of open contexts */ DLIST_ADD(p->contexts, context_fns); - DEBUG(4,("Created internal pipe %s (pipes_open=%d)\n", - get_pipe_name_from_syntax(talloc_tos(), syntax), pipes_open)); + DEBUG(4,("Created internal pipe %s\n", + get_pipe_name_from_syntax(talloc_tos(), syntax))); talloc_set_destructor(p, close_internal_rpc_pipe_hnd); -- cgit From b5aeee76c926f102c3bee396c831475b1eeb18d5 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 25 May 2011 17:37:51 +0200 Subject: s3-epmapper: Register ports on IPv4 too. Autobuild-User: Andreas Schneider Autobuild-Date: Wed Jun 1 13:14:53 CEST 2011 on sn-devel-104 --- source3/rpc_server/epmd.c | 2 +- source3/rpc_server/rpc_ep_setup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index 81ebc46a9db..bb241ff2c1f 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -68,7 +68,7 @@ static bool epmd_open_sockets(struct tevent_context *ev_ctx, if (strequal(sock_addr, "0.0.0.0") || strequal(sock_addr, "::")) { #if HAVE_IPV6 - sock_addr = "::"; + sock_addr = "::,0.0.0.0"; #else sock_addr = "0.0.0.0"; #endif diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 3ed2f0dc9d2..e5059dae807 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -94,7 +94,7 @@ static uint16_t _open_sockets(struct tevent_context *ev_ctx, if (strequal(sock_addr, "0.0.0.0") || strequal(sock_addr, "::")) { #if HAVE_IPV6 - sock_addr = "::"; + sock_addr = "::,0.0.0.0"; #else sock_addr = "0.0.0.0"; #endif -- cgit From b08bd96dc0919ae1194f1269c01a78194d674e9c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Jun 2011 14:45:59 -0700 Subject: Fix bug where format arguments were reversed. Please compile with -Wall ! --- source3/rpc_server/rpc_handles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 0b302510e07..7fa59b6b117 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -363,9 +363,9 @@ void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd, if (p->pipe_handles->count > MAX_OPEN_POLS) { DEBUG(0, ("ERROR: Too many handles (%d) for RPC connection %s\n", + (int) p->pipe_handles->count, get_pipe_name_from_syntax(talloc_tos(), - &p->contexts->syntax), - (int) p->pipe_handles->count)); + &p->contexts->syntax))); *pstatus = NT_STATUS_INSUFFICIENT_RESOURCES; return NULL; } -- cgit From 114fbc385cbf00f2736a6d7a49447ab816dd5a7f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 5 Jun 2011 13:56:39 +0200 Subject: s3: Fix a valgrind error For me this fixes ==1950== Invalid read of size 4 ==1950== at 0x81EBED5: GUID_equal (uuid.c:239) ==1950== by 0x81E51AB: ndr_syntax_id_equal (ndr_misc.c:35) ==1950== by 0x82EB0D1: get_iface_from_syntax (rpc_common.c:160) ==1950== by 0x82EB25E: get_pipe_name_from_syntax (rpc_common.c:179) ==1950== by 0x8509E4F: close_policy_by_pipe (rpc_handles.c:322) ==1950== by 0x8507941: close_internal_rpc_pipe_hnd (rpc_ncacn_np.c:109) ==1950== by 0x468270: _talloc_free_internal (talloc.c:826) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x80E6487: sam_trusted_domains (winbindd_samr.c:406) ==1950== Address 0x687ea4 is 20 bytes inside a block of size 40 free'd ==1950== at 0x58CDC: free (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-freebsd.so) ==1950== by 0x8507812: free_pipe_rpc_context_internal (rpc_ncacn_np.c:74) ==1950== by 0x8507936: close_internal_rpc_pipe_hnd (rpc_ncacn_np.c:106) ==1950== by 0x468270: _talloc_free_internal (talloc.c:826) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x467EE0: _talloc_free_internal (talloc.c:1268) ==1950== by 0x80E6487: sam_trusted_domains (winbindd_samr.c:406) ==1950== by 0x80C2F85: trusted_domains (winbindd_cache.c:2820) ==1950== by 0x80D5188: winbindd_dual_list_trusted_domains (winbindd_misc.c:162) ==1950== by 0x80E987F: wb_child_request_trigger (winbindd_dual.c:437) ==1950== Andreas, Guenther, please check! Autobuild-User: Volker Lendecke Autobuild-Date: Sun Jun 5 13:19:39 CEST 2011 on sn-devel-104 --- source3/rpc_server/rpc_ncacn_np.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 4446578e3f9..e578c77ddab 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -103,11 +103,11 @@ int close_internal_rpc_pipe_hnd(struct pipes_struct *p) TALLOC_FREE(p->auth.auth_ctx); - free_pipe_rpc_context_internal( p->contexts ); - /* Free the handles database. */ close_policy_by_pipe(p); + free_pipe_rpc_context_internal( p->contexts ); + DLIST_REMOVE(InternalPipes, p); ZERO_STRUCTP(p); -- cgit From 47ea009e86a2a4499e216d97e5b64cc9e52a27ad Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 8 Jun 2011 12:00:46 +0200 Subject: s3-spoolss: fix -Wunused-but-set-variable build warning in _spoolss_EnumPrintProcDataTypes(). We were in fact ignoring the error code here. Guenther --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 52e4ab0a724..a946bc91d0f 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -8831,6 +8831,10 @@ WERROR _spoolss_EnumPrintProcDataTypes(struct pipes_struct *p, return WERR_UNKNOWN_LEVEL; } + if (!W_ERROR_IS_OK(result)) { + return result; + } + *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(p->mem_ctx, spoolss_EnumPrintProcDataTypes, *r->out.info, r->in.level, -- cgit From 73b377432c5efb8451f09f6d25d8aa1b28c239c9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:10:15 +1000 Subject: s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc() Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett --- source3/rpc_server/lsa/srv_lsa_nt.c | 2 +- source3/rpc_server/spoolss/srv_spoolss_nt.c | 22 +++++++++++----------- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index da0f697dc98..393dc314543 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -122,7 +122,7 @@ static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx, ref->count = num + 1; ref->max_size = LSA_REF_DOMAIN_LIST_MULTIPLIER; - ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains, + ref->domains = talloc_realloc(mem_ctx, ref->domains, struct lsa_DomainInfo, ref->count); if (!ref->domains) { return -1; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index a946bc91d0f..6b037232a6c 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1094,7 +1094,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS if ( i == ctr->num_groups ) { ctr->num_groups++; - if ( !(groups = TALLOC_REALLOC_ARRAY( ctr->ctx, ctr->msg_groups, SPOOLSS_NOTIFY_MSG_GROUP, ctr->num_groups)) ) { + if ( !(groups = talloc_realloc( ctr->ctx, ctr->msg_groups, SPOOLSS_NOTIFY_MSG_GROUP, ctr->num_groups)) ) { DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed!\n")); return 0; } @@ -1112,7 +1112,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS msg_grp->num_msgs++; - if ( !(msg_list = TALLOC_REALLOC_ARRAY( ctr->ctx, msg_grp->msgs, SPOOLSS_NOTIFY_MSG, msg_grp->num_msgs )) ) { + if ( !(msg_list = talloc_realloc( ctr->ctx, msg_grp->msgs, SPOOLSS_NOTIFY_MSG, msg_grp->num_msgs )) ) { DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed for new message [%d]!\n", msg_grp->num_msgs)); return 0; } @@ -3438,7 +3438,7 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx, if (!search_notify(type, field, &j) ) continue; - info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, + info->notifies = talloc_realloc(info, info->notifies, struct spoolss_Notify, info->count + 1); if (info->notifies == NULL) { @@ -3498,7 +3498,7 @@ static bool construct_notify_jobs_info(struct messaging_context *msg_ctx, if (!search_notify(type, field, &j) ) continue; - info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, + info->notifies = talloc_realloc(info, info->notifies, struct spoolss_Notify, info->count + 1); if (info->notifies == NULL) { @@ -4307,7 +4307,7 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx, goto out; } - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, union spoolss_PrinterInfo, count + 1); if (!info) { @@ -5347,7 +5347,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, *count_p = 0; if (strlen(driver->driver_path)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5362,7 +5362,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->config_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5377,7 +5377,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->data_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5392,7 +5392,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->help_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5407,7 +5407,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } for (i=0; driver->dependent_files[i] && driver->dependent_files[i][0] != '\0'; i++) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -7292,7 +7292,7 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx, num_drivers, architecture, version)); if (num_drivers != 0) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, union spoolss_DriverInfo, count + num_drivers); if (!info) { diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 7251d70dd98..c63a81dd77b 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -101,7 +101,7 @@ static int pipe_enum_fn( struct db_record *rec, void *p) return 1; } - f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + f = talloc_realloc(fenum->ctx, fenum->ctr3->array, struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); @@ -179,7 +179,7 @@ static void enum_file_fn( const struct share_mode_entry *e, return; } - f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + f = talloc_realloc(fenum->ctx, fenum->ctr3->array, struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); @@ -816,7 +816,7 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p, for (; resume_handle < *total_entries; resume_handle++) { - ctr0->array = TALLOC_REALLOC_ARRAY(p->mem_ctx, + ctr0->array = talloc_realloc(p->mem_ctx, ctr0->array, struct srvsvc_NetSessInfo0, num_entries+1); @@ -914,7 +914,7 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p, num_files = net_count_files(pw->pw_uid, session_list[resume_handle].pid); guest = strequal( session_list[resume_handle].username, lp_guestaccount() ); - ctr1->array = TALLOC_REALLOC_ARRAY(p->mem_ctx, + ctr1->array = talloc_realloc(p->mem_ctx, ctr1->array, struct srvsvc_NetSessInfo1, num_entries+1); @@ -969,7 +969,7 @@ static WERROR init_srv_conn_info_0(struct srvsvc_NetConnCtr0 *ctr0, for (; resume_handle < *total_entries; resume_handle++) { - ctr0->array = TALLOC_REALLOC_ARRAY(talloc_tos(), + ctr0->array = talloc_realloc(talloc_tos(), ctr0->array, struct srvsvc_NetConnInfo0, num_entries+1); @@ -1023,7 +1023,7 @@ static WERROR init_srv_conn_info_1(struct srvsvc_NetConnCtr1 *ctr1, for (; resume_handle < *total_entries; resume_handle++) { - ctr1->array = TALLOC_REALLOC_ARRAY(talloc_tos(), + ctr1->array = talloc_realloc(talloc_tos(), ctr1->array, struct srvsvc_NetConnInfo1, num_entries+1); -- cgit From 3d15137653a7d1b593a9af2eef12f6e5b9a04c4f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:30:12 +1000 Subject: s3-talloc Change TALLOC_ARRAY() to talloc_array() Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc. --- source3/rpc_server/dfs/srv_dfs_nt.c | 10 +++++----- source3/rpc_server/echo/srv_echo_nt.c | 4 ++-- source3/rpc_server/lsa/srv_lsa_nt.c | 8 ++++---- source3/rpc_server/samr/srv_samr_nt.c | 2 +- source3/rpc_server/spoolss/srv_spoolss_nt.c | 20 ++++++++++---------- source3/rpc_server/spoolss/srv_spoolss_util.c | 4 ++-- source3/rpc_server/svcctl/srv_svcctl_nt.c | 4 ++-- source3/rpc_server/winreg/srv_winreg_nt.c | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 6ca35a5dcc9..723760d601e 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -88,7 +88,7 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) return WERR_NOMEM; } - jn->referral_list = TALLOC_ARRAY(ctx, struct referral, jn->referral_count); + jn->referral_list = talloc_array(ctx, struct referral, jn->referral_count); if(jn->referral_list == NULL) { DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n")); return WERR_DFS_INTERNAL_ERROR; @@ -233,7 +233,7 @@ static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, s /* also enumerate the stores */ if (j->referral_count) { - dfs3->stores = TALLOC_ARRAY(mem_ctx, struct dfs_StorageInfo, j->referral_count); + dfs3->stores = talloc_array(mem_ctx, struct dfs_StorageInfo, j->referral_count); if (!dfs3->stores) return False; memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); @@ -295,7 +295,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) switch (r->in.level) { case 1: if (num_jn) { - if ((r->out.info->e.info1->s = TALLOC_ARRAY(ctx, struct dfs_Info1, num_jn)) == NULL) { + if ((r->out.info->e.info1->s = talloc_array(ctx, struct dfs_Info1, num_jn)) == NULL) { return WERR_NOMEM; } } else { @@ -305,7 +305,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) break; case 2: if (num_jn) { - if ((r->out.info->e.info2->s = TALLOC_ARRAY(ctx, struct dfs_Info2, num_jn)) == NULL) { + if ((r->out.info->e.info2->s = talloc_array(ctx, struct dfs_Info2, num_jn)) == NULL) { return WERR_NOMEM; } } else { @@ -315,7 +315,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) break; case 3: if (num_jn) { - if ((r->out.info->e.info3->s = TALLOC_ARRAY(ctx, struct dfs_Info3, num_jn)) == NULL) { + if ((r->out.info->e.info3->s = talloc_array(ctx, struct dfs_Info3, num_jn)) == NULL) { return WERR_NOMEM; } } else { diff --git a/source3/rpc_server/echo/srv_echo_nt.c b/source3/rpc_server/echo/srv_echo_nt.c index c7a9e1a97da..7c8ae19b82b 100644 --- a/source3/rpc_server/echo/srv_echo_nt.c +++ b/source3/rpc_server/echo/srv_echo_nt.c @@ -48,7 +48,7 @@ void _echo_EchoData(struct pipes_struct *p, struct echo_EchoData *r) return; } - r->out.out_data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len); + r->out.out_data = talloc_array(p->mem_ctx, uint8, r->in.len); memcpy( r->out.out_data, r->in.in_data, r->in.len ); return; } @@ -76,7 +76,7 @@ void _echo_SourceData(struct pipes_struct *p, struct echo_SourceData *r) return; } - r->out.data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len ); + r->out.data = talloc_array(p->mem_ctx, uint8, r->in.len ); for (i = 0; i < r->in.len; i++ ) { r->out.data[i] = i & 0xff; diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 393dc314543..a120c6e7fe9 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -858,7 +858,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p, return NT_STATUS_OK; } - sids = TALLOC_ARRAY(p->mem_ctx, const struct dom_sid *, num_sids); + sids = talloc_array(p->mem_ctx, const struct dom_sid *, num_sids); ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList); if (sids == NULL || ref == NULL) { @@ -876,7 +876,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p, return status; } - names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids); + names = talloc_array(p->mem_ctx, struct lsa_TranslatedName2, num_sids); if (names == NULL) { return NT_STATUS_NO_MEMORY; } @@ -998,7 +998,7 @@ NTSTATUS _lsa_LookupSids(struct pipes_struct *p, } /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */ - names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName, + names_out = talloc_array(p->mem_ctx, struct lsa_TranslatedName, num_sids); if (!names_out) { return NT_STATUS_NO_MEMORY; @@ -1257,7 +1257,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p, status = _lsa_LookupNames(p, &q); sid_array2->count = sid_array->count; - sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count); + sid_array2->sids = talloc_array(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count); if (!sid_array2->sids) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 41e684d63d7..186526edfc2 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -5298,7 +5298,7 @@ NTSTATUS _samr_GetAliasMembership(struct pipes_struct *p, return NT_STATUS_OBJECT_TYPE_MISMATCH; if (r->in.sids->num_sids) { - members = TALLOC_ARRAY(p->mem_ctx, struct dom_sid, r->in.sids->num_sids); + members = talloc_array(p->mem_ctx, struct dom_sid, r->in.sids->num_sids); if (members == NULL) return NT_STATUS_NO_MEMORY; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 6b037232a6c..f397333b4e4 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -6924,7 +6924,7 @@ static WERROR enumjobs_level1(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -6968,7 +6968,7 @@ static WERROR enumjobs_level2(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -7023,7 +7023,7 @@ static WERROR enumjobs_level3(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -7632,7 +7632,7 @@ static WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines) /* if no hook then just fill in the default port */ if ( !*cmd ) { - if (!(qlines = TALLOC_ARRAY( NULL, char*, 2 ))) { + if (!(qlines = talloc_array( NULL, char*, 2 ))) { return WERR_NOMEM; } if (!(qlines[0] = talloc_strdup(qlines, SAMBA_PRINTER_PORT_NAME ))) { @@ -7693,7 +7693,7 @@ static WERROR enumports_level_1(TALLOC_CTX *mem_ctx, } if (numlines) { - info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); + info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines); if (!info) { DEBUG(10,("Returning WERR_NOMEM\n")); result = WERR_NOMEM; @@ -7745,7 +7745,7 @@ static WERROR enumports_level_2(TALLOC_CTX *mem_ctx, } if (numlines) { - info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); + info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines); if (!info) { DEBUG(10,("Returning WERR_NOMEM\n")); result = WERR_NOMEM; @@ -8672,7 +8672,7 @@ static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx, union spoolss_PrintProcessorInfo *info; WERROR result; - info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcessorInfo, 1); + info = talloc_array(mem_ctx, union spoolss_PrintProcessorInfo, 1); W_ERROR_HAVE_NO_MEMORY(info); *count = 1; @@ -8774,7 +8774,7 @@ static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx, WERROR result; union spoolss_PrintProcDataTypesInfo *info; - info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcDataTypesInfo, 1); + info = talloc_array(mem_ctx, union spoolss_PrintProcDataTypesInfo, 1); W_ERROR_HAVE_NO_MEMORY(info); *count = 1; @@ -8890,7 +8890,7 @@ static WERROR enumprintmonitors_level_1(TALLOC_CTX *mem_ctx, union spoolss_MonitorInfo *info; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_MonitorInfo, 2); + info = talloc_array(mem_ctx, union spoolss_MonitorInfo, 2); W_ERROR_HAVE_NO_MEMORY(info); *count = 2; @@ -8930,7 +8930,7 @@ static WERROR enumprintmonitors_level_2(TALLOC_CTX *mem_ctx, union spoolss_MonitorInfo *info; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_MonitorInfo, 2); + info = talloc_array(mem_ctx, union spoolss_MonitorInfo, 2); W_ERROR_HAVE_NO_MEMORY(info); *count = 2; diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index c8e96e077dd..8505c8ffb5b 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -449,7 +449,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx, return WERR_OK; } - enum_values = TALLOC_ARRAY(tmp_ctx, struct spoolss_PrinterEnumValues, num_values); + enum_values = talloc_array(tmp_ctx, struct spoolss_PrinterEnumValues, num_values); if (enum_values == NULL) { result = WERR_NOMEM; goto error; @@ -3084,7 +3084,7 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx, goto done; } - info = TALLOC_ARRAY(tmp_ctx, union spoolss_FormInfo, num_builtin + num_values); + info = talloc_array(tmp_ctx, union spoolss_FormInfo, num_builtin + num_values); if (info == NULL) { result = WERR_NOMEM; goto done; diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index bf7ade8be6c..b2b8a1923d7 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -71,7 +71,7 @@ bool init_service_op_table( void ) int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_length( service_list ); int i; - if ( !(svcctl_ops = TALLOC_ARRAY( NULL, struct service_control_op, num_services+1)) ) { + if ( !(svcctl_ops = talloc_array( NULL, struct service_control_op, num_services+1)) ) { DEBUG(0,("init_service_op_table: talloc() failed!\n")); return False; } @@ -421,7 +421,7 @@ static int enumerate_status(TALLOC_CTX *ctx, while ( svcctl_ops[num_services].name ) num_services++; - if ( !(st = TALLOC_ARRAY( ctx, struct ENUM_SERVICE_STATUSW, num_services )) ) { + if ( !(st = talloc_array( ctx, struct ENUM_SERVICE_STATUSW, num_services )) ) { DEBUG(0,("enumerate_status: talloc() failed!\n")); return -1; } diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c index 6f319e99054..6fee5b6acd9 100644 --- a/source3/rpc_server/winreg/srv_winreg_nt.c +++ b/source3/rpc_server/winreg/srv_winreg_nt.c @@ -542,7 +542,7 @@ WERROR _winreg_InitiateSystemShutdownEx(struct pipes_struct *p, if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->string )) == NULL ) { return WERR_NOMEM; } - chkmsg = TALLOC_ARRAY(p->mem_ctx, char, strlen(msg)+1); + chkmsg = talloc_array(p->mem_ctx, char, strlen(msg)+1); if (!chkmsg) { return WERR_NOMEM; } -- cgit From d5e6a47f064a3923b1e257ab84fa7ccd7c4f89f4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:38:41 +1000 Subject: s3-talloc Change TALLOC_P() to talloc() Using the standard macro makes it easier to move code into common, as TALLOC_P isn't standard talloc. --- source3/rpc_server/lsa/srv_lsa_nt.c | 4 ++-- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index a120c6e7fe9..48cec630942 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -2412,14 +2412,14 @@ NTSTATUS _lsa_GetUserName(struct pipes_struct *p, domname = p->session_info->info3->base.domain.string; } - account_name = TALLOC_P(p->mem_ctx, struct lsa_String); + account_name = talloc(p->mem_ctx, struct lsa_String); if (!account_name) { return NT_STATUS_NO_MEMORY; } init_lsa_String(account_name, username); if (r->out.authority_name) { - authority_name = TALLOC_P(p->mem_ctx, struct lsa_String); + authority_name = talloc(p->mem_ctx, struct lsa_String); if (!authority_name) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index c63a81dd77b..228cb96cc04 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1139,7 +1139,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, case 102: { struct srvsvc_NetSrvInfo102 *info102; - info102 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo102); + info102 = talloc(p->mem_ctx, struct srvsvc_NetSrvInfo102); if (!info102) { return WERR_NOMEM; } @@ -1165,7 +1165,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, case 101: { struct srvsvc_NetSrvInfo101 *info101; - info101 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo101); + info101 = talloc(p->mem_ctx, struct srvsvc_NetSrvInfo101); if (!info101) { return WERR_NOMEM; } @@ -1184,7 +1184,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, case 100: { struct srvsvc_NetSrvInfo100 *info100; - info100 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo100); + info100 = talloc(p->mem_ctx, struct srvsvc_NetSrvInfo100); if (!info100) { return WERR_NOMEM; } @@ -1454,47 +1454,47 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p, switch (r->in.level) { case 0: - info->info0 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo0); + info->info0 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo0); W_ERROR_HAVE_NO_MEMORY(info->info0); init_srv_share_info_0(p, info->info0, snum); break; case 1: - info->info1 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1); + info->info1 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo1); W_ERROR_HAVE_NO_MEMORY(info->info1); init_srv_share_info_1(p, info->info1, snum); break; case 2: - info->info2 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo2); + info->info2 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo2); W_ERROR_HAVE_NO_MEMORY(info->info2); init_srv_share_info_2(p, info->info2, snum); break; case 501: - info->info501 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo501); + info->info501 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo501); W_ERROR_HAVE_NO_MEMORY(info->info501); init_srv_share_info_501(p, info->info501, snum); break; case 502: - info->info502 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo502); + info->info502 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo502); W_ERROR_HAVE_NO_MEMORY(info->info502); init_srv_share_info_502(p, info->info502, snum); break; case 1004: - info->info1004 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1004); + info->info1004 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo1004); W_ERROR_HAVE_NO_MEMORY(info->info1004); init_srv_share_info_1004(p, info->info1004, snum); break; case 1005: - info->info1005 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1005); + info->info1005 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo1005); W_ERROR_HAVE_NO_MEMORY(info->info1005); init_srv_share_info_1005(p, info->info1005, snum); break; case 1006: - info->info1006 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1006); + info->info1006 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo1006); W_ERROR_HAVE_NO_MEMORY(info->info1006); init_srv_share_info_1006(p, info->info1006, snum); break; case 1007: - info->info1007 = TALLOC_P(p->mem_ctx, struct srvsvc_NetShareInfo1007); + info->info1007 = talloc(p->mem_ctx, struct srvsvc_NetShareInfo1007); W_ERROR_HAVE_NO_MEMORY(info->info1007); init_srv_share_info_1007(p, info->info1007, snum); break; -- cgit From ad0a07c531fadd1639c5298951cfaf5cfe0cb10e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:44:43 +1000 Subject: s3-talloc Change TALLOC_ZERO_P() to talloc_zero() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc. --- source3/rpc_server/dfs/srv_dfs_nt.c | 14 +++++++------- source3/rpc_server/dssetup/srv_dssetup_nt.c | 2 +- source3/rpc_server/eventlog/srv_eventlog_nt.c | 2 +- source3/rpc_server/lsa/srv_lsa_nt.c | 18 ++++++++--------- source3/rpc_server/netlogon/srv_netlog_nt.c | 14 +++++++------- source3/rpc_server/rpc_ncacn_np.c | 4 ++-- source3/rpc_server/samr/srv_samr_nt.c | 28 +++++++++++++-------------- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 24 +++++++++++------------ source3/rpc_server/svcctl/srv_svcctl_nt.c | 2 +- 9 files changed, 54 insertions(+), 54 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 723760d601e..486e14e268b 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -59,7 +59,7 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) return WERR_ACCESS_DENIED; } - jn = TALLOC_ZERO_P(ctx, struct junction_map); + jn = talloc_zero(ctx, struct junction_map); if (!jn) { return WERR_NOMEM; } @@ -124,7 +124,7 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) return WERR_ACCESS_DENIED; } - jn = TALLOC_ZERO_P(ctx, struct junction_map); + jn = talloc_zero(ctx, struct junction_map); if (!jn) { return WERR_NOMEM; } @@ -354,7 +354,7 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r) TALLOC_CTX *ctx = talloc_tos(); bool ret; - jn = TALLOC_ZERO_P(ctx, struct junction_map); + jn = talloc_zero(ctx, struct junction_map); if (!jn) { return WERR_NOMEM; } @@ -372,28 +372,28 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r) switch (r->in.level) { case 1: - r->out.info->info1 = TALLOC_ZERO_P(ctx,struct dfs_Info1); + r->out.info->info1 = talloc_zero(ctx,struct dfs_Info1); if (!r->out.info->info1) { return WERR_NOMEM; } ret = init_reply_dfs_info_1(ctx, jn, r->out.info->info1); break; case 2: - r->out.info->info2 = TALLOC_ZERO_P(ctx,struct dfs_Info2); + r->out.info->info2 = talloc_zero(ctx,struct dfs_Info2); if (!r->out.info->info2) { return WERR_NOMEM; } ret = init_reply_dfs_info_2(ctx, jn, r->out.info->info2); break; case 3: - r->out.info->info3 = TALLOC_ZERO_P(ctx,struct dfs_Info3); + r->out.info->info3 = talloc_zero(ctx,struct dfs_Info3); if (!r->out.info->info3) { return WERR_NOMEM; } ret = init_reply_dfs_info_3(ctx, jn, r->out.info->info3); break; case 100: - r->out.info->info100 = TALLOC_ZERO_P(ctx,struct dfs_Info100); + r->out.info->info100 = talloc_zero(ctx,struct dfs_Info100); if (!r->out.info->info100) { return WERR_NOMEM; } diff --git a/source3/rpc_server/dssetup/srv_dssetup_nt.c b/source3/rpc_server/dssetup/srv_dssetup_nt.c index d90ad421371..1cf4ab80746 100644 --- a/source3/rpc_server/dssetup/srv_dssetup_nt.c +++ b/source3/rpc_server/dssetup/srv_dssetup_nt.c @@ -42,7 +42,7 @@ static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DEBUG(10,("fill_dsrole_dominfo_basic: enter\n")); - basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic); + basic = talloc_zero(ctx, struct dssetup_DsRolePrimaryDomInfoBasic); if (!basic) { DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n")); return WERR_NOMEM; diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c index b4c59ba5174..16a0c974881 100644 --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c @@ -212,7 +212,7 @@ static NTSTATUS elog_open( struct pipes_struct * p, const char *logname, struct if ( !elog_validate_logname( logname ) ) return NT_STATUS_OBJECT_PATH_INVALID; - if ( !(elog = TALLOC_ZERO_P( NULL, EVENTLOG_INFO )) ) + if ( !(elog = talloc_zero( NULL, EVENTLOG_INFO )) ) return NT_STATUS_NO_MEMORY; talloc_set_destructor(elog, eventlog_info_destructor); diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 48cec630942..cb9eae297c8 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -628,7 +628,7 @@ NTSTATUS _lsa_QueryInfoPolicy(struct pipes_struct *p, /* return NT_STATUS_ACCESS_DENIED; */ } - info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation); + info = talloc_zero(p->mem_ctx, union lsa_PolicyInformation); if (!info) { return NT_STATUS_NO_MEMORY; } @@ -859,7 +859,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p, } sids = talloc_array(p->mem_ctx, const struct dom_sid *, num_sids); - ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList); + ref = talloc_zero(p->mem_ctx, struct lsa_RefDomainList); if (sids == NULL || ref == NULL) { return NT_STATUS_NO_MEMORY; @@ -1168,7 +1168,7 @@ NTSTATUS _lsa_LookupNames(struct pipes_struct *p, flags = lsa_lookup_level_to_flags(r->in.level); - domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList); + domains = talloc_zero(p->mem_ctx, struct lsa_RefDomainList); if (!domains) { return NT_STATUS_NO_MEMORY; } @@ -1235,7 +1235,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p, struct lsa_TransSidArray *sid_array = NULL; uint32_t i; - sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray); + sid_array = talloc_zero(p->mem_ctx, struct lsa_TransSidArray); if (!sid_array) { return NT_STATUS_NO_MEMORY; } @@ -1310,7 +1310,7 @@ NTSTATUS _lsa_LookupNames3(struct pipes_struct *p, flags = LOOKUP_NAME_ALL; } - domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList); + domains = talloc_zero(p->mem_ctx, struct lsa_RefDomainList); if (!domains) { return NT_STATUS_NO_MEMORY; } @@ -2012,7 +2012,7 @@ NTSTATUS _lsa_QueryTrustedDomainInfo(struct pipes_struct *p, return status; } - info = TALLOC_ZERO_P(p->mem_ctx, union lsa_TrustedDomainInfo); + info = talloc_zero(p->mem_ctx, union lsa_TrustedDomainInfo); if (!info) { return NT_STATUS_NO_MEMORY; } @@ -2299,7 +2299,7 @@ NTSTATUS _lsa_LookupPrivDisplayName(struct pipes_struct *p, DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description)); - lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge); + lsa_name = talloc_zero(p->mem_ctx, struct lsa_StringLarge); if (!lsa_name) { return NT_STATUS_NO_MEMORY; } @@ -2597,7 +2597,7 @@ NTSTATUS _lsa_EnumPrivsAccount(struct pipes_struct *p, return status; } - *r->out.privs = priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet); + *r->out.privs = priv_set = talloc_zero(p->mem_ctx, struct lsa_PrivilegeSet); if (!priv_set) { return NT_STATUS_NO_MEMORY; } @@ -2801,7 +2801,7 @@ NTSTATUS _lsa_LookupPrivName(struct pipes_struct *p, return NT_STATUS_NO_SUCH_PRIVILEGE; } - lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge); + lsa_name = talloc_zero(p->mem_ctx, struct lsa_StringLarge); if (!lsa_name) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index e3c95fc06bc..46789f106a4 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -346,7 +346,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, switch (r->in.level) { case 1: - info1 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_1); + info1 = talloc_zero(p->mem_ctx, struct netr_NETLOGON_INFO_1); W_ERROR_HAVE_NO_MEMORY(info1); info1->flags = flags; @@ -355,7 +355,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, r->out.query->info1 = info1; break; case 2: - info2 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_2); + info2 = talloc_zero(p->mem_ctx, struct netr_NETLOGON_INFO_2); W_ERROR_HAVE_NO_MEMORY(info2); info2->flags = flags; @@ -366,7 +366,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, r->out.query->info2 = info2; break; case 3: - info3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_3); + info3 = talloc_zero(p->mem_ctx, struct netr_NETLOGON_INFO_3); W_ERROR_HAVE_NO_MEMORY(info3); info3->flags = flags; @@ -375,7 +375,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, r->out.query->info3 = info3; break; case 4: - info4 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_4); + info4 = talloc_zero(p->mem_ctx, struct netr_NETLOGON_INFO_4); W_ERROR_HAVE_NO_MEMORY(info4); info4->trusted_dc_name = dc_name; @@ -1421,19 +1421,19 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p, switch (r->in.validation_level) { case 2: - r->out.validation->sam2 = TALLOC_ZERO_P(p->mem_ctx, struct netr_SamInfo2); + r->out.validation->sam2 = talloc_zero(p->mem_ctx, struct netr_SamInfo2); if (!r->out.validation->sam2) { return NT_STATUS_NO_MEMORY; } break; case 3: - r->out.validation->sam3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_SamInfo3); + r->out.validation->sam3 = talloc_zero(p->mem_ctx, struct netr_SamInfo3); if (!r->out.validation->sam3) { return NT_STATUS_NO_MEMORY; } break; case 6: - r->out.validation->sam6 = TALLOC_ZERO_P(p->mem_ctx, struct netr_SamInfo6); + r->out.validation->sam6 = talloc_zero(p->mem_ctx, struct netr_SamInfo6); if (!r->out.validation->sam6) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index e578c77ddab..f14aae540d3 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -131,7 +131,7 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx, DEBUG(4,("Create pipe requested %s\n", get_pipe_name_from_syntax(talloc_tos(), syntax))); - p = TALLOC_ZERO_P(mem_ctx, struct pipes_struct); + p = talloc_zero(mem_ctx, struct pipes_struct); if (!p) { DEBUG(0,("ERROR! no memory for pipes_struct!\n")); @@ -563,7 +563,7 @@ static NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *result; NTSTATUS status; - result = TALLOC_ZERO_P(mem_ctx, struct rpc_pipe_client); + result = talloc_zero(mem_ctx, struct rpc_pipe_client); if (result == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 186526edfc2..9f96127c0f3 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -842,7 +842,7 @@ NTSTATUS _samr_EnumDomainUsers(struct pipes_struct *p, return status; } - samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray); + samr_array = talloc_zero(p->mem_ctx, struct samr_SamArray); if (!samr_array) { return NT_STATUS_NO_MEMORY; } @@ -977,7 +977,7 @@ NTSTATUS _samr_EnumDomainGroups(struct pipes_struct *p, DEBUG(5,("_samr_EnumDomainGroups: %d\n", __LINE__)); - samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray); + samr_array = talloc_zero(p->mem_ctx, struct samr_SamArray); if (!samr_array) { return NT_STATUS_NO_MEMORY; } @@ -1055,7 +1055,7 @@ NTSTATUS _samr_EnumDomainAliases(struct pipes_struct *p, DEBUG(5,("_samr_EnumDomainAliases: sid %s\n", sid_string_dbg(&dinfo->sid))); - samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray); + samr_array = talloc_zero(p->mem_ctx, struct samr_SamArray); if (!samr_array) { return NT_STATUS_NO_MEMORY; } @@ -1578,7 +1578,7 @@ NTSTATUS _samr_QueryAliasInfo(struct pipes_struct *p, return status; } - alias_info = TALLOC_ZERO_P(p->mem_ctx, union samr_AliasInfo); + alias_info = talloc_zero(p->mem_ctx, union samr_AliasInfo); if (!alias_info) { return NT_STATUS_NO_MEMORY; } @@ -1984,12 +1984,12 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, time_t u_expire, u_min_age; uint32 account_policy_temp; - dominfo = TALLOC_ZERO_P(p->mem_ctx, struct samr_DomInfo1); + dominfo = talloc_zero(p->mem_ctx, struct samr_DomInfo1); if (!dominfo) { return NT_STATUS_NO_MEMORY; } - reject = TALLOC_ZERO_P(p->mem_ctx, + reject = talloc_zero(p->mem_ctx, struct userPwdChangeFailureInformation); if (!reject) { return NT_STATUS_NO_MEMORY; @@ -2288,7 +2288,7 @@ static NTSTATUS init_samr_parameters_string(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - r = TALLOC_ZERO_P(mem_ctx, struct lsa_BinaryString); + r = talloc_zero(mem_ctx, struct lsa_BinaryString); if (!r) { return NT_STATUS_NO_MEMORY; } @@ -2987,7 +2987,7 @@ NTSTATUS _samr_QueryUserInfo(struct pipes_struct *p, DEBUG(5,("_samr_QueryUserInfo: sid:%s\n", sid_string_dbg(&uinfo->sid))); - user_info = TALLOC_ZERO_P(p->mem_ctx, union samr_UserInfo); + user_info = talloc_zero(p->mem_ctx, union samr_UserInfo); if (!user_info) { return NT_STATUS_NO_MEMORY; } @@ -3149,7 +3149,7 @@ NTSTATUS _samr_GetGroupsForUser(struct pipes_struct *p, return result; } - rids = TALLOC_ZERO_P(p->mem_ctx, struct samr_RidWithAttributeArray); + rids = talloc_zero(p->mem_ctx, struct samr_RidWithAttributeArray); if (!rids) { return NT_STATUS_NO_MEMORY; } @@ -3598,7 +3598,7 @@ NTSTATUS _samr_QueryDomainInfo(struct pipes_struct *p, return status; } - dom_info = TALLOC_ZERO_P(p->mem_ctx, union samr_DomainInfo); + dom_info = talloc_zero(p->mem_ctx, union samr_DomainInfo); if (!dom_info) { return NT_STATUS_NO_MEMORY; } @@ -4054,7 +4054,7 @@ NTSTATUS _samr_LookupDomain(struct pipes_struct *p, return NT_STATUS_INVALID_PARAMETER; } - sid = TALLOC_ZERO_P(p->mem_ctx, struct dom_sid2); + sid = talloc_zero(p->mem_ctx, struct dom_sid2); if (!sid) { return NT_STATUS_NO_MEMORY; } @@ -4095,7 +4095,7 @@ NTSTATUS _samr_EnumDomains(struct pipes_struct *p, return status; } - sam = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray); + sam = talloc_zero(p->mem_ctx, struct samr_SamArray); if (!sam) { return NT_STATUS_NO_MEMORY; } @@ -5415,7 +5415,7 @@ NTSTATUS _samr_QueryGroupMember(struct pipes_struct *p, return status; } - rids = TALLOC_ZERO_P(p->mem_ctx, struct samr_RidAttrArray); + rids = talloc_zero(p->mem_ctx, struct samr_RidAttrArray); if (!rids) { return NT_STATUS_NO_MEMORY; } @@ -5954,7 +5954,7 @@ NTSTATUS _samr_QueryGroupInfo(struct pipes_struct *p, group_name = talloc_strdup(r, map.nt_name); group_description = talloc_strdup(r, map.comment); - info = TALLOC_ZERO_P(p->mem_ctx, union samr_GroupInfo); + info = talloc_zero(p->mem_ctx, union samr_GroupInfo); if (!info) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 228cb96cc04..7fd068f1af5 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -600,7 +600,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, alloc_entries = num_entries - resume_handle; switch (info_ctr->level) { case 0: - ctr.ctr0 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr0); + ctr.ctr0 = talloc_zero(ctx, struct srvsvc_NetShareCtr0); W_ERROR_HAVE_NO_MEMORY(ctr.ctr0); ctr.ctr0->count = alloc_entries; @@ -617,7 +617,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1: - ctr.ctr1 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1); + ctr.ctr1 = talloc_zero(ctx, struct srvsvc_NetShareCtr1); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1); ctr.ctr1->count = alloc_entries; @@ -634,7 +634,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 2: - ctr.ctr2 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr2); + ctr.ctr2 = talloc_zero(ctx, struct srvsvc_NetShareCtr2); W_ERROR_HAVE_NO_MEMORY(ctr.ctr2); ctr.ctr2->count = alloc_entries; @@ -651,7 +651,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 501: - ctr.ctr501 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr501); + ctr.ctr501 = talloc_zero(ctx, struct srvsvc_NetShareCtr501); W_ERROR_HAVE_NO_MEMORY(ctr.ctr501); ctr.ctr501->count = alloc_entries; @@ -668,7 +668,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 502: - ctr.ctr502 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr502); + ctr.ctr502 = talloc_zero(ctx, struct srvsvc_NetShareCtr502); W_ERROR_HAVE_NO_MEMORY(ctr.ctr502); ctr.ctr502->count = alloc_entries; @@ -685,7 +685,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1004: - ctr.ctr1004 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1004); + ctr.ctr1004 = talloc_zero(ctx, struct srvsvc_NetShareCtr1004); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004); ctr.ctr1004->count = alloc_entries; @@ -702,7 +702,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1005: - ctr.ctr1005 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1005); + ctr.ctr1005 = talloc_zero(ctx, struct srvsvc_NetShareCtr1005); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005); ctr.ctr1005->count = alloc_entries; @@ -719,7 +719,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1006: - ctr.ctr1006 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1006); + ctr.ctr1006 = talloc_zero(ctx, struct srvsvc_NetShareCtr1006); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006); ctr.ctr1006->count = alloc_entries; @@ -736,7 +736,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1007: - ctr.ctr1007 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1007); + ctr.ctr1007 = talloc_zero(ctx, struct srvsvc_NetShareCtr1007); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007); ctr.ctr1007->count = alloc_entries; @@ -753,7 +753,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, break; case 1501: - ctr.ctr1501 = TALLOC_ZERO_P(ctx, struct srvsvc_NetShareCtr1501); + ctr.ctr1501 = talloc_zero(ctx, struct srvsvc_NetShareCtr1501); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501); ctr.ctr1501->count = alloc_entries; @@ -2062,7 +2062,7 @@ WERROR _srvsvc_NetRemoteTOD(struct pipes_struct *p, DEBUG(5,("_srvsvc_NetRemoteTOD: %d\n", __LINE__)); - if ( !(tod = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetRemoteTODInfo)) ) + if ( !(tod = talloc_zero(p->mem_ctx, struct srvsvc_NetRemoteTODInfo)) ) return WERR_NOMEM; *r->out.info = tod; @@ -2189,7 +2189,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p, sd_size = ndr_size_security_descriptor(psd, 0); - sd_buf = TALLOC_ZERO_P(p->mem_ctx, struct sec_desc_buf); + sd_buf = talloc_zero(p->mem_ctx, struct sec_desc_buf); if (!sd_buf) { werr = WERR_NOMEM; goto error_exit; diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index b2b8a1923d7..96ac399e165 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -209,7 +209,7 @@ static WERROR create_open_service_handle(struct pipes_struct *p, WERROR result = WERR_OK; struct service_control_op *s_op; - if ( !(info = TALLOC_ZERO_P( NULL, SERVICE_INFO )) ) + if ( !(info = talloc_zero( NULL, SERVICE_INFO )) ) return WERR_NOMEM; /* the Service Manager has a NULL name */ -- cgit From 5e26e94092b56ee47e7ec7837f7cd0feb3fb0119 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:58:39 +1000 Subject: s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc. --- source3/rpc_server/lsa/srv_lsa_nt.c | 16 ++++++++-------- source3/rpc_server/samr/srv_samr_nt.c | 30 +++++++++++++++--------------- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 24 ++++++++++++------------ 3 files changed, 35 insertions(+), 35 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index cb9eae297c8..c6f45eaad0f 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -520,7 +520,7 @@ NTSTATUS _lsa_EnumTrustDom(struct pipes_struct *p, return nt_status; } - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo, count); + entries = talloc_zero_array(p->mem_ctx, struct lsa_DomainInfo, count); if (!entries) { return NT_STATUS_NO_MEMORY; } @@ -681,7 +681,7 @@ NTSTATUS _lsa_QueryInfoPolicy(struct pipes_struct *p, info->audit_events.auditing_mode = true; info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES; - info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx, + info->audit_events.settings = talloc_zero_array(p->mem_ctx, enum lsa_PolicyAuditPolicy, info->audit_events.count); if (!info->audit_events.settings) { @@ -1174,7 +1174,7 @@ NTSTATUS _lsa_LookupNames(struct pipes_struct *p, } if (num_entries) { - rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid, + rids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid, num_entries); if (!rids) { return NT_STATUS_NO_MEMORY; @@ -1316,7 +1316,7 @@ NTSTATUS _lsa_LookupNames3(struct pipes_struct *p, } if (num_entries) { - trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3, + trans_sids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid3, num_entries); if (!trans_sids) { return NT_STATUS_NO_MEMORY; @@ -2230,7 +2230,7 @@ NTSTATUS _lsa_EnumPrivs(struct pipes_struct *p, return NT_STATUS_ACCESS_DENIED; if (num_privs) { - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs); + entries = talloc_zero_array(p->mem_ctx, struct lsa_PrivEntry, num_privs); if (!entries) { return NT_STATUS_NO_MEMORY; } @@ -2351,7 +2351,7 @@ NTSTATUS _lsa_EnumAccounts(struct pipes_struct *p, } if (num_entries - *r->in.resume_handle) { - sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr, + sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr, num_entries - *r->in.resume_handle); if (!sids) { talloc_free(sid_list); @@ -3030,7 +3030,7 @@ static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx, if (num_priv) { - r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge, + r->names = talloc_zero_array(mem_ctx, struct lsa_StringLarge, num_priv); if (!r->names) { return NT_STATUS_NO_MEMORY; @@ -3323,7 +3323,7 @@ NTSTATUS _lsa_EnumTrustedDomainsEx(struct pipes_struct *p, return nt_status; } - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx, + entries = talloc_zero_array(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx, count); if (!entries) { return NT_STATUS_NO_MEMORY; diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 9f96127c0f3..e5f59e604b6 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -784,7 +784,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, return NT_STATUS_OK; } - sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_entries); + sam = talloc_zero_array(ctx, struct samr_SamEntry, num_entries); if (sam == NULL) { DEBUG(0, ("make_user_sam_entry_list: TALLOC_ZERO failed!\n")); return NT_STATUS_NO_MEMORY; @@ -938,7 +938,7 @@ static void make_group_sam_entry_list(TALLOC_CTX *ctx, return; } - sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_sam_entries); + sam = talloc_zero_array(ctx, struct samr_SamEntry, num_sam_entries); if (sam == NULL) { return; } @@ -1120,7 +1120,7 @@ static NTSTATUS init_samr_dispinfo_1(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryGeneral, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1164,7 +1164,7 @@ static NTSTATUS init_samr_dispinfo_2(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryFull, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1205,7 +1205,7 @@ static NTSTATUS init_samr_dispinfo_3(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryFullGroup, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1246,7 +1246,7 @@ static NTSTATUS init_samr_dispinfo_4(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1282,7 +1282,7 @@ static NTSTATUS init_samr_dispinfo_5(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -2050,7 +2050,7 @@ static bool make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names, *lsa_name_array_p = NULL; if (num_names != 0) { - lsa_name_array = TALLOC_ZERO_ARRAY(ctx, struct lsa_String, num_names); + lsa_name_array = talloc_zero_array(ctx, struct lsa_String, num_names); if (!lsa_name_array) { return false; } @@ -2100,9 +2100,9 @@ NTSTATUS _samr_LookupRids(struct pipes_struct *p, } if (num_rids) { - names = TALLOC_ZERO_ARRAY(p->mem_ctx, const char *, num_rids); - attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, enum lsa_SidType, num_rids); - wire_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_rids); + names = talloc_zero_array(p->mem_ctx, const char *, num_rids); + attrs = talloc_zero_array(p->mem_ctx, enum lsa_SidType, num_rids); + wire_attrs = talloc_zero_array(p->mem_ctx, uint32, num_rids); if ((names == NULL) || (attrs == NULL) || (wire_attrs==NULL)) return NT_STATUS_NO_MEMORY; @@ -2293,7 +2293,7 @@ static NTSTATUS init_samr_parameters_string(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - r->array = TALLOC_ZERO_ARRAY(mem_ctx, uint16_t, blob->length/2); + r->array = talloc_zero_array(mem_ctx, uint16_t, blob->length/2); if (!r->array) { return NT_STATUS_NO_MEMORY; } @@ -4100,7 +4100,7 @@ NTSTATUS _samr_EnumDomains(struct pipes_struct *p, return NT_STATUS_NO_MEMORY; } - entry_array = TALLOC_ZERO_ARRAY(p->mem_ctx, + entry_array = talloc_zero_array(p->mem_ctx, struct samr_SamEntry, num_entries); if (!entry_array) { @@ -5369,7 +5369,7 @@ NTSTATUS _samr_GetMembersInAlias(struct pipes_struct *p, } if (num_sids) { - sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr, num_sids); + sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr, num_sids); if (sids == NULL) { TALLOC_FREE(pdb_sids); return NT_STATUS_NO_MEMORY; @@ -5439,7 +5439,7 @@ NTSTATUS _samr_QueryGroupMember(struct pipes_struct *p, return status; if (num_members) { - attr=TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_members); + attr=talloc_zero_array(p->mem_ctx, uint32, num_members); if (attr == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 7fd068f1af5..dd23a090f20 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -574,7 +574,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, num_services = lp_numservices(); unbecome_root(); - allowed = TALLOC_ZERO_ARRAY(ctx, bool, num_services); + allowed = talloc_zero_array(ctx, bool, num_services); W_ERROR_HAVE_NO_MEMORY(allowed); /* Count the number of entries. */ @@ -604,7 +604,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr0); ctr.ctr0->count = alloc_entries; - ctr.ctr0->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo0, alloc_entries); + ctr.ctr0->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo0, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr0->array); for (snum = 0; snum < num_services; snum++) { @@ -621,7 +621,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1); ctr.ctr1->count = alloc_entries; - ctr.ctr1->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1, alloc_entries); + ctr.ctr1->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1->array); for (snum = 0; snum < num_services; snum++) { @@ -638,7 +638,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr2); ctr.ctr2->count = alloc_entries; - ctr.ctr2->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo2, alloc_entries); + ctr.ctr2->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo2, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr2->array); for (snum = 0; snum < num_services; snum++) { @@ -655,7 +655,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr501); ctr.ctr501->count = alloc_entries; - ctr.ctr501->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo501, alloc_entries); + ctr.ctr501->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo501, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr501->array); for (snum = 0; snum < num_services; snum++) { @@ -672,7 +672,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr502); ctr.ctr502->count = alloc_entries; - ctr.ctr502->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo502, alloc_entries); + ctr.ctr502->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo502, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr502->array); for (snum = 0; snum < num_services; snum++) { @@ -689,7 +689,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004); ctr.ctr1004->count = alloc_entries; - ctr.ctr1004->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1004, alloc_entries); + ctr.ctr1004->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1004, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004->array); for (snum = 0; snum < num_services; snum++) { @@ -706,7 +706,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005); ctr.ctr1005->count = alloc_entries; - ctr.ctr1005->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1005, alloc_entries); + ctr.ctr1005->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1005, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005->array); for (snum = 0; snum < num_services; snum++) { @@ -723,7 +723,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006); ctr.ctr1006->count = alloc_entries; - ctr.ctr1006->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1006, alloc_entries); + ctr.ctr1006->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1006, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006->array); for (snum = 0; snum < num_services; snum++) { @@ -740,7 +740,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007); ctr.ctr1007->count = alloc_entries; - ctr.ctr1007->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1007, alloc_entries); + ctr.ctr1007->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1007, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007->array); for (snum = 0; snum < num_services; snum++) { @@ -757,7 +757,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501); ctr.ctr1501->count = alloc_entries; - ctr.ctr1501->array = TALLOC_ZERO_ARRAY(ctx, struct sec_desc_buf, alloc_entries); + ctr.ctr1501->array = talloc_zero_array(ctx, struct sec_desc_buf, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501->array); for (snum = 0; snum < num_services; snum++) { @@ -2438,7 +2438,7 @@ WERROR _srvsvc_NetDiskEnum(struct pipes_struct *p, *r->out.totalentries = init_server_disk_enum(&resume); - r->out.info->disks = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetDiskInfo0, + r->out.info->disks = talloc_zero_array(ctx, struct srvsvc_NetDiskInfo0, MAX_SERVER_DISK_ENTRIES); W_ERROR_HAVE_NO_MEMORY(r->out.info->disks); -- cgit From 8d4a8389bb2df77ff8923dda8368aa2915652c1a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 12:13:26 +1000 Subject: s3-talloc Change TALLOC_MEMDUP() to talloc_memdup() Using the standard macro makes it easier to move code into common, as TALLOC_MEMDUP isn't standard talloc. --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index f397333b4e4..1be5100d9ed 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1125,7 +1125,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS if ( msg->len != 0 ) msg_grp->msgs[new_slot].notify.data = (char *) - TALLOC_MEMDUP( ctr->ctx, msg->notify.data, msg->len ); + talloc_memdup( ctr->ctx, msg->notify.data, msg->len ); return ctr->num_groups; } -- cgit From 74eed8f3ed5c333728350df1d23a4318e9104909 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 9 Jun 2011 15:31:03 +1000 Subject: s3-param Remove special case for global_myname(), rename to lp_netbios_name() There is no reason this can't be a normal constant string in the loadparm system, now that we have lp_set_cmdline() to handle overrides correctly. Andrew Bartlett --- source3/rpc_server/dfs/srv_dfs_nt.c | 8 ++++---- source3/rpc_server/netlogon/srv_netlog_nt.c | 2 +- source3/rpc_server/samr/srv_samr_nt.c | 6 +++--- source3/rpc_server/spoolss/srv_spoolss_nt.c | 14 +++++++------- source3/rpc_server/spoolss/srv_spoolss_util.c | 6 +++--- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 6 +++--- source3/rpc_server/wkssvc/srv_wkssvc_nt.c | 10 +++++----- 7 files changed, 26 insertions(+), 26 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 486e14e268b..5b4e423393c 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -193,7 +193,7 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) static bool init_reply_dfs_info_1(TALLOC_CTX *mem_ctx, struct junction_map* j,struct dfs_Info1* dfs1) { dfs1->path = talloc_asprintf(mem_ctx, - "\\\\%s\\%s\\%s", global_myname(), + "\\\\%s\\%s\\%s", lp_netbios_name(), j->service_name, j->volume_name); if (dfs1->path == NULL) return False; @@ -205,7 +205,7 @@ static bool init_reply_dfs_info_1(TALLOC_CTX *mem_ctx, struct junction_map* j,st static bool init_reply_dfs_info_2(TALLOC_CTX *mem_ctx, struct junction_map* j, struct dfs_Info2* dfs2) { dfs2->path = talloc_asprintf(mem_ctx, - "\\\\%s\\%s\\%s", global_myname(), j->service_name, j->volume_name); + "\\\\%s\\%s\\%s", lp_netbios_name(), j->service_name, j->volume_name); if (dfs2->path == NULL) return False; dfs2->comment = talloc_strdup(mem_ctx, j->comment); @@ -219,9 +219,9 @@ static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, s int ii; if (j->volume_name[0] == '\0') dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", - global_myname(), j->service_name); + lp_netbios_name(), j->service_name); else - dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s\\%s", global_myname(), + dfs3->path = talloc_asprintf(mem_ctx, "\\\\%s\\%s\\%s", lp_netbios_name(), j->service_name, j->volume_name); if (dfs3->path == NULL) diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index 46789f106a4..03897d77a47 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -522,7 +522,7 @@ static NTSTATUS samr_find_machine_account(TALLOC_CTX *mem_ctx, uint32_t rid; status = dcerpc_samr_Connect2(b, mem_ctx, - global_myname(), + lp_netbios_name(), SAMR_ACCESS_CONNECT_TO_SERVER | SAMR_ACCESS_ENUM_DOMAINS | SAMR_ACCESS_LOOKUP_DOMAIN, diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index e5f59e604b6..a253f307ac6 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -3323,7 +3323,7 @@ static NTSTATUS query_dom_info_2(TALLOC_CTX *mem_ctx, r->oem_information.string = lp_serverstring(); r->domain_name.string = lp_workgroup(); - r->primary.string = global_myname(); + r->primary.string = lp_netbios_name(); r->sequence_num = seq_num; r->domain_server_state = DOMAIN_SERVER_ENABLED; r->role = (enum samr_Role) samr_get_server_role(); @@ -3390,7 +3390,7 @@ static NTSTATUS query_dom_info_6(TALLOC_CTX *mem_ctx, /* NT returns its own name when a PDC. win2k and later * only the name of the PDC if itself is a BDC (samba4 * idl) */ - r->primary.string = global_myname(); + r->primary.string = lp_netbios_name(); return NT_STATUS_OK; } @@ -6132,7 +6132,7 @@ NTSTATUS _samr_SetAliasInfo(struct pipes_struct *p, /* make sure the name doesn't already exist as a user or local group */ - fstr_sprintf( group_name, "%s\\%s", global_myname(), info.acct_name ); + fstr_sprintf( group_name, "%s\\%s", lp_netbios_name(), info.acct_name ); status = can_create( p->mem_ctx, group_name ); if ( !NT_STATUS_IS_OK( status ) ) return status; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 1be5100d9ed..cb311ef0433 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -2523,7 +2523,7 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe, } /* setup the connection */ - ret = cli_full_connection( &the_cli, global_myname(), remote_machine, + ret = cli_full_connection( &the_cli, lp_netbios_name(), remote_machine, &rm_addr, 0, "IPC$", "IPC", "", /* username */ "", /* domain */ @@ -6037,7 +6037,7 @@ static bool check_printer_ok(TALLOC_CTX *mem_ctx, info2->location)); /* we force some elements to "correct" values */ - info2->servername = talloc_asprintf(mem_ctx, "\\\\%s", global_myname()); + info2->servername = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name()); if (info2->servername == NULL) { return false; } @@ -6049,7 +6049,7 @@ static bool check_printer_ok(TALLOC_CTX *mem_ctx, /* check to see if we allow printername != sharename */ if (lp_force_printername(snum)) { info2->printername = talloc_asprintf(mem_ctx, "\\\\%s\\%s", - global_myname(), info2->sharename); + lp_netbios_name(), info2->sharename); } else { /* make sure printername is in \\server\printername format */ fstrcpy(printername, info2->printername); @@ -6060,7 +6060,7 @@ static bool check_printer_ok(TALLOC_CTX *mem_ctx, } info2->printername = talloc_asprintf(mem_ctx, "\\\\%s\\%s", - global_myname(), p); + lp_netbios_name(), p); } if (info2->printername == NULL) { return false; @@ -6446,7 +6446,7 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx, buffer.length); } - push_reg_sz(mem_ctx, &buffer, global_myname()); + push_reg_sz(mem_ctx, &buffer, lp_netbios_name()); winreg_set_printer_dataex(mem_ctx, session_info, msg_ctx, @@ -6461,7 +6461,7 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx, if (dnsdomname != NULL && dnsdomname[0] != '\0') { longname = talloc_strdup(mem_ctx, dnsdomname); } else { - longname = talloc_strdup(mem_ctx, global_myname()); + longname = talloc_strdup(mem_ctx, lp_netbios_name()); } if (longname == NULL) { result = WERR_NOMEM; @@ -6480,7 +6480,7 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx, buffer.length); uncname = talloc_asprintf(mem_ctx, "\\\\%s\\%s", - global_myname(), printer->sharename); + lp_netbios_name(), printer->sharename); push_reg_sz(mem_ctx, &buffer, uncname); winreg_set_printer_dataex(mem_ctx, session_info, diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index 8505c8ffb5b..ecb35670600 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -1047,7 +1047,7 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx, winreg_handle, &key_hnd, SPOOL_REG_SHORTSERVERNAME, - global_myname(), + lp_netbios_name(), &result); if (!NT_STATUS_IS_OK(status)) { result = ntstatus_to_werror(status); @@ -1062,9 +1062,9 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx, */ dnssuffix = get_mydnsdomname(tmp_ctx); if (dnssuffix != NULL && dnssuffix[0] != '\0') { - longname = talloc_asprintf(tmp_ctx, "%s.%s", global_myname(), dnssuffix); + longname = talloc_asprintf(tmp_ctx, "%s.%s", lp_netbios_name(), dnssuffix); } else { - longname = talloc_strdup(tmp_ctx, global_myname()); + longname = talloc_strdup(tmp_ctx, lp_netbios_name()); } if (longname == NULL) { result = WERR_NOMEM; diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index dd23a090f20..64a7264eceb 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1145,7 +1145,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, } info102->platform_id = PLATFORM_ID_NT; - info102->server_name = global_myname(); + info102->server_name = lp_netbios_name(); info102->version_major = lp_major_announce_version(); info102->version_minor = lp_minor_announce_version(); info102->server_type = lp_default_server_announce(); @@ -1171,7 +1171,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, } info101->platform_id = PLATFORM_ID_NT; - info101->server_name = global_myname(); + info101->server_name = lp_netbios_name(); info101->version_major = lp_major_announce_version(); info101->version_minor = lp_minor_announce_version(); info101->server_type = lp_default_server_announce(); @@ -1190,7 +1190,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, } info100->platform_id = PLATFORM_ID_NT; - info100->server_name = global_myname(); + info100->server_name = lp_netbios_name(); r->out.info->info100 = info100; diff --git a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c index cd257b4a26f..633aa133603 100644 --- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c +++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c @@ -196,7 +196,7 @@ static struct dom_usr *get_domain_userlist(TALLOC_CTX *mem_ctx) DEBUG(10, ("talloc_asprintf failed\n")); continue; } - if (strcmp(machine_name, global_myname()) == 0) { + if (strcmp(machine_name, lp_netbios_name()) == 0) { p = session_list[i].username; nm = strstr(p, sep); if (nm) { @@ -264,7 +264,7 @@ static struct wkssvc_NetWkstaInfo100 *create_wks_info_100(TALLOC_CTX *mem_ctx) info100->version_minor = lp_minor_announce_version(); info100->server_name = talloc_asprintf_strupper_m( - info100, "%s", global_myname()); + info100, "%s", lp_netbios_name()); info100->domain_name = talloc_asprintf_strupper_m( info100, "%s", lp_workgroup()); @@ -293,7 +293,7 @@ static struct wkssvc_NetWkstaInfo101 *create_wks_info_101(TALLOC_CTX *mem_ctx) info101->version_minor = lp_minor_announce_version(); info101->server_name = talloc_asprintf_strupper_m( - info101, "%s", global_myname()); + info101, "%s", lp_netbios_name()); info101->domain_name = talloc_asprintf_strupper_m( info101, "%s", lp_workgroup()); info101->lan_root = ""; @@ -324,7 +324,7 @@ static struct wkssvc_NetWkstaInfo102 *create_wks_info_102(TALLOC_CTX *mem_ctx) info102->version_minor = lp_minor_announce_version(); info102->server_name = talloc_asprintf_strupper_m( - info102, "%s", global_myname()); + info102, "%s", lp_netbios_name()); info102->domain_name = talloc_asprintf_strupper_m( info102, "%s", lp_workgroup()); info102->lan_root = ""; @@ -528,7 +528,7 @@ static struct wkssvc_NetWkstaEnumUsersCtr1 *create_enum_users1( /* For a local user the domain name and logon server are * both returned as the local machine's NetBIOS name */ ctr1->user1[i].logon_domain = ctr1->user1[i].logon_server = - talloc_asprintf_strupper_m(ctr1->user1, "%s", global_myname()); + talloc_asprintf_strupper_m(ctr1->user1, "%s", lp_netbios_name()); ctr1->user1[i].other_domains = NULL; /* Maybe in future? */ } -- cgit From 48de3e51eacbd1051f79dc99aaac8a4ec988fde5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 16 Jun 2011 08:33:09 +0200 Subject: s3:rpc_server/svcctl: don't allocate return values on a temporary stackframe And always initialize the whole return structure. This caused samba3.posix_s3.rpc.svcctl to be flakey. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Thu Jun 16 11:34:34 CEST 2011 on sn-devel-104 --- source3/rpc_server/svcctl/srv_svcctl_nt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index 96ac399e165..4f8a2c1b7da 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -668,17 +668,18 @@ WERROR _svcctl_QueryServiceStatusEx(struct pipes_struct *p, /******************************************************************** ********************************************************************/ -static WERROR fill_svc_config(TALLOC_CTX *ctx, +static WERROR fill_svc_config(TALLOC_CTX *mem_ctx, struct messaging_context *msg_ctx, struct auth_serversupplied_info *session_info, const char *name, struct QUERY_SERVICE_CONFIG *config) { - TALLOC_CTX *mem_ctx = talloc_stackframe(); const char *result = NULL; /* now fill in the individual values */ + ZERO_STRUCTP(config); + config->displayname = svcctl_lookup_dispname(mem_ctx, msg_ctx, session_info, @@ -720,9 +721,6 @@ static WERROR fill_svc_config(TALLOC_CTX *ctx, else config->start_type = SVCCTL_DEMAND_START; - - talloc_free(mem_ctx); - return WERR_OK; } -- cgit From 11683ccf3e68606ecb1cdfa455f7921b119803c6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 16 Jun 2011 12:34:42 +0200 Subject: s3:rpc_server/svcctl: fix valgrind bugs in _svcctl_QueryServiceConfig2W() r->out.buffer needs to stay in its size, as it will be marshalled completely. As it's preallocated and initialized with zeros, we just need to copy the payload into it. If we always marshall the return buffer, we already have the needed buffer size and don't need to call ndr_size_* functions. metze --- source3/rpc_server/svcctl/srv_svcctl_nt.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index 4f8a2c1b7da..8523def037b 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -775,7 +775,8 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, struct svcctl_QueryServiceConfig2W *r) { SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.handle ); - uint32 buffer_size; + uint32_t buffer_size; + DATA_BLOB blob = data_blob_null; /* perform access checks */ @@ -795,7 +796,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, struct SERVICE_DESCRIPTION desc_buf; const char *description; enum ndr_err_code ndr_err; - DATA_BLOB blob; description = svcctl_lookup_description(p->mem_ctx, p->msg_ctx, @@ -810,9 +810,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, return WERR_INVALID_PARAM; } - buffer_size = ndr_size_SERVICE_DESCRIPTION(&desc_buf, 0); - r->out.buffer = blob.data; - break; } break; @@ -820,7 +817,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, { struct SERVICE_FAILURE_ACTIONS actions; enum ndr_err_code ndr_err; - DATA_BLOB blob; /* nothing to say...just service the request */ @@ -832,9 +828,6 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, return WERR_INVALID_PARAM; } - buffer_size = ndr_size_SERVICE_FAILURE_ACTIONS(&actions, 0); - r->out.buffer = blob.data; - break; } break; @@ -843,12 +836,15 @@ WERROR _svcctl_QueryServiceConfig2W(struct pipes_struct *p, return WERR_UNKNOWN_LEVEL; } + buffer_size = blob.length; buffer_size += buffer_size % 4; *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered; if (buffer_size > r->in.offered) return WERR_INSUFFICIENT_BUFFER; + memcpy(r->out.buffer, blob.data, blob.length); + return WERR_OK; } -- cgit From 67512152c007bb186e4fd8dac5d1aab89bce0689 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 16 Jun 2011 12:47:22 +0200 Subject: s3:rpc_server/svcctl: fix valgrind bug in _svcctl_QueryServiceObjectSecurity() r->out.buffer needs to stay in its size, as it will be marshalled completely. As it's preallocated and initialized with zeros, we just need to copy the payload into it, even if it's smaller than the offered buffer size. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Thu Jun 16 14:15:47 CEST 2011 on sn-devel-104 --- source3/rpc_server/svcctl/srv_svcctl_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index 8523def037b..f515906339f 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -936,7 +936,7 @@ WERROR _svcctl_QueryServiceObjectSecurity(struct pipes_struct *p, } *r->out.needed = len; - r->out.buffer = buffer; + memcpy(r->out.buffer, buffer, len); return WERR_OK; } -- cgit From 5a7874e119acbc80410b2f2c1847371236c22a56 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:31 +0930 Subject: tdb_traverse/tdb_traverse_read: check returns for negative, not -1. TDB2 returns a negative error number on failure. This is compatible if we always check for < 0 instead of == -1. Also, there's no tdb_traverse_read in TDB2: we don't try to make traverse reliable any more, so there are no write locks anyway. Signed-off-by: Rusty Russell --- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 64a7264eceb..2aed300febc 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -136,7 +136,7 @@ static WERROR net_enum_pipes(TALLOC_CTX *ctx, fenum.username = username; fenum.ctr3 = *ctr3; - if (connections_traverse(pipe_enum_fn, &fenum) == -1) { + if (connections_traverse(pipe_enum_fn, &fenum) < 0) { DEBUG(0,("net_enum_pipes: traverse of connections.tdb " "failed\n")); return WERR_NOMEM; -- cgit From 5db74b9607f4a5fc5ecaa8be0d744222cd55153c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 20 Jun 2011 20:36:46 +1000 Subject: lib/util Remove samba-util-common! All of this code is now in common, so we don't need the second '-common' library any more! Andrew Bartlett --- source3/rpc_server/wscript_build | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index 0e557a4bb75..5d21d5e3408 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -31,7 +31,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', source='rpc_server.c', - deps='samba-util-common') + deps='samba-util') bld.SAMBA3_SUBSYSTEM('RPC_CRYPTO', source='dcesrv_ntlmssp.c dcesrv_gssapi.c dcesrv_spnego.c', @@ -39,19 +39,19 @@ bld.SAMBA3_SUBSYSTEM('RPC_CRYPTO', bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER', source='srv_pipe_register.c', - deps='samba-util-common') + deps='samba-util') bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER', source='rpc_ep_setup.c ../librpc/rpc/dcerpc_ep.c', - deps='samba-util-common') + deps='samba-util') bld.SAMBA3_SUBSYSTEM('EPMD', source='epmd.c', - deps='samba-util-common') + deps='samba-util') bld.SAMBA3_SUBSYSTEM('SRV_ACCESS_CHECK', source='srv_access_check.c', - deps='samba-util-common') + deps='samba-util') bld.SAMBA3_SUBSYSTEM('RPC_SAMR', source=RPC_SAMR_SRC, @@ -70,12 +70,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_WINREG', bld.SAMBA3_SUBSYSTEM('RPC_INITSHUTDOWN', source=RPC_INITSHUTDOWN_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_DSSETUP', source=RPC_DSSETUP_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_WKSSVC', @@ -90,7 +90,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SVCCTL', bld.SAMBA3_SUBSYSTEM('RPC_NTSVCS', source=RPC_NTSVCS_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_NETLOGON', @@ -100,12 +100,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_NETLOGON', bld.SAMBA3_SUBSYSTEM('RPC_NETDFS', source=RPC_NETDFS_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SRVSVC', source=RPC_SRVSVC_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SPOOLSS', @@ -120,12 +120,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_EVENTLOG', bld.SAMBA3_SUBSYSTEM('RPC_RPCECHO', source=RPC_RPCECHO_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_EPMAPPER', source=RPC_EPMAPPER_SRC, - deps='samba-util-common', + deps='samba-util', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SERVER', -- cgit From c173e6e80db7505ccc71d95ed602804133d602d7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 20 Jun 2011 19:27:01 +0200 Subject: s3-spoolss: Fix some valgrind warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are in/out values and need to be initialized. Signed-off-by: Günther Deschner Autobuild-User: Günther Deschner Autobuild-Date: Tue Jun 21 18:58:30 CEST 2011 on sn-devel-104 --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 6 +++--- source3/rpc_server/spoolss/srv_spoolss_util.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index cb311ef0433..8216388905f 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -9191,9 +9191,9 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p, int snum = 0; WERROR result = WERR_OK; DATA_BLOB blob; - enum winreg_Type val_type; - uint8_t *val_data; - uint32_t val_size; + enum winreg_Type val_type = REG_NONE; + uint8_t *val_data = NULL; + uint32_t val_size = 0; DEBUG(4,("_spoolss_GetPrinterDataEx\n")); diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index ecb35670600..5201571a372 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -471,7 +471,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx, data_size = max_valbufsize; data = NULL; if (data_size) { - data = (uint8_t *) TALLOC(tmp_ctx, data_size); + data = (uint8_t *) talloc_zero_size(tmp_ctx, data_size); } length = 0; @@ -2315,9 +2315,9 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx, struct dcerpc_binding_handle *winreg_handle = NULL; struct policy_handle hive_hnd, key_hnd; struct winreg_String wvalue; - enum winreg_Type type_in; + enum winreg_Type type_in = REG_NONE; char *path; - uint8_t *data_in; + uint8_t *data_in = NULL; uint32_t data_in_size = 0; uint32_t value_len = 0; WERROR result = WERR_OK; @@ -3337,8 +3337,8 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx, struct dcerpc_binding_handle *winreg_handle = NULL; struct policy_handle hive_hnd, key_hnd; struct winreg_String wvalue; - enum winreg_Type type_in; - uint8_t *data_in; + enum winreg_Type type_in = REG_NONE; + uint8_t *data_in = NULL; uint32_t data_in_size = 0; uint32_t value_len = 0; uint32_t num_builtin = ARRAY_SIZE(builtin_forms1); -- cgit From 734e1b6812b672fc7d838e943b14b8a176552734 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 21 Jun 2011 15:14:29 +1000 Subject: s3-param Remove 'announce version' parameter The only users I can find of this on the internet involve confused users, and our own documentation recommends never setting this. Don't confuse our users any longer. Andrew Bartlett --- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 8 ++++---- source3/rpc_server/wkssvc/srv_wkssvc_nt.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 2aed300febc..752b8576676 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1146,8 +1146,8 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, info102->platform_id = PLATFORM_ID_NT; info102->server_name = lp_netbios_name(); - info102->version_major = lp_major_announce_version(); - info102->version_minor = lp_minor_announce_version(); + info102->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + info102->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; info102->server_type = lp_default_server_announce(); info102->comment = string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH); @@ -1172,8 +1172,8 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p, info101->platform_id = PLATFORM_ID_NT; info101->server_name = lp_netbios_name(); - info101->version_major = lp_major_announce_version(); - info101->version_minor = lp_minor_announce_version(); + info101->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + info101->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; info101->server_type = lp_default_server_announce(); info101->comment = string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH); diff --git a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c index 633aa133603..49c71b8d6eb 100644 --- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c +++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c @@ -260,8 +260,8 @@ static struct wkssvc_NetWkstaInfo100 *create_wks_info_100(TALLOC_CTX *mem_ctx) } info100->platform_id = PLATFORM_ID_NT; /* unknown */ - info100->version_major = lp_major_announce_version(); - info100->version_minor = lp_minor_announce_version(); + info100->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + info100->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; info100->server_name = talloc_asprintf_strupper_m( info100, "%s", lp_netbios_name()); @@ -289,8 +289,8 @@ static struct wkssvc_NetWkstaInfo101 *create_wks_info_101(TALLOC_CTX *mem_ctx) } info101->platform_id = PLATFORM_ID_NT; /* unknown */ - info101->version_major = lp_major_announce_version(); - info101->version_minor = lp_minor_announce_version(); + info101->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + info101->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; info101->server_name = talloc_asprintf_strupper_m( info101, "%s", lp_netbios_name()); @@ -320,8 +320,8 @@ static struct wkssvc_NetWkstaInfo102 *create_wks_info_102(TALLOC_CTX *mem_ctx) } info102->platform_id = PLATFORM_ID_NT; /* unknown */ - info102->version_major = lp_major_announce_version(); - info102->version_minor = lp_minor_announce_version(); + info102->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + info102->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; info102->server_name = talloc_asprintf_strupper_m( info102, "%s", lp_netbios_name()); -- cgit