From f7bc84409a7a6736ec2cf1110dd7200a954e3b7e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 24 Apr 2011 00:00:40 +0200 Subject: s3:rpc_client: map fault codes to NTSTATUS with dcerpc_fault_to_nt_status() Most fault codes have a NTSTATUS representation, so use that. This brings the fault handling in common with the source4/librpc/rpc code, which make it possible to share more highlevel code, between source3 and source4 as the error checking can be the same now. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Sun Apr 24 10:44:53 CEST 2011 on sn-devel-104 --- source3/lib/netapi/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 63be7ac751..653ece1385 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -322,7 +322,7 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx, 25, &user_info, &result); - if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) { + if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) { user_info.info23.info = info21; -- cgit From ee0b0dd3a150dea35ef57d5867519a7df382137c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 27 Apr 2011 15:41:49 +0200 Subject: s3-netapi: Fix Coverity CID #2302: FORWARD_NULL Guenther --- source3/lib/netapi/localgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c index 51f4e1d745..49ba74ec17 100644 --- a/source3/lib/netapi/localgroup.c +++ b/source3/lib/netapi/localgroup.c @@ -1344,7 +1344,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, werr = WERR_OK; done: - if (is_valid_policy_hnd(&alias_handle)) { + if (b && is_valid_policy_hnd(&alias_handle)) { dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result); } -- 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/lib/netapi/netapi_private.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h index 7559c61564..349287b9e9 100644 --- a/source3/lib/netapi/netapi_private.h +++ b/source3/lib/netapi/netapi_private.h @@ -29,6 +29,8 @@ } \ return fn ## _r(ctx, r); +struct dcerpc_binding_handle; + struct libnetapi_private_ctx { struct { const char *domain_name; -- cgit From e131c94ac1b06cc49b1c25717d3496dba8b0b3df Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 5 May 2011 13:42:05 -0700 Subject: More const fixes for compiler warnings from the waf build. --- source3/lib/netapi/samr.c | 2 +- source3/lib/netapi/user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c index 544698004a..1c3a94ee9c 100644 --- a/source3/lib/netapi/samr.c +++ b/source3/lib/netapi/samr.c @@ -240,7 +240,7 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx, status = dcerpc_samr_OpenDomain(b, mem_ctx, connect_handle, builtin_mask, - CONST_DISCARD(struct dom_sid *, &global_sid_Builtin), + discard_const_p(struct dom_sid, &global_sid_Builtin), builtin_handle, &result); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 653ece1385..7831e20a0a 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -575,7 +575,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, status = dcerpc_samr_OpenDomain(b, talloc_tos(), &connect_handle, SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, - CONST_DISCARD(struct dom_sid *, &global_sid_Builtin), + discard_const_p(struct dom_sid, &global_sid_Builtin), &builtin_handle, &result); if (!NT_STATUS_IS_OK(status)) { -- 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/lib/netapi/cm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index 290194ba2d..4c9bfcb419 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -22,6 +22,7 @@ #include "lib/netapi/netapi.h" #include "lib/netapi/netapi_private.h" +#include "libsmb/libsmb.h" #include "rpc_client/cli_pipe.h" /******************************************************************** -- cgit From 29eea4b09ad2e99504f42a3c29195fb4757792dd Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 7 Apr 2011 17:19:03 +0200 Subject: libsmbconf: Convert smbconf_init() to sbcErr. Signed-off-by: Michael Adam --- source3/lib/netapi/serverinfo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 22c7df69d1..e995bdaf47 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -541,6 +541,7 @@ static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx, struct NetServerSetInfo *r) { WERROR werr; + sbcErr err; struct smbconf_ctx *conf_ctx; struct srvsvc_NetSrvInfo1005 *info1005; @@ -563,8 +564,12 @@ static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - werr = smbconf_init_reg(ctx, &conf_ctx, NULL); - if (!W_ERROR_IS_OK(werr)) { + err = smbconf_init_reg(ctx, &conf_ctx, NULL); + if (!SBC_ERROR_IS_OK(err)) { + libnetapi_set_error_string(ctx, + "Could not initialize backend: %s", + sbcErrorString(err)); + werr = WERR_NO_SUCH_SERVICE; goto done; } -- cgit From ddc28a683fcf036a279a0d3d7b23504364316fa6 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 11 Apr 2011 13:23:26 +0200 Subject: libsmbconf: Convert smbconf_set_parameter() to sbcErr. Signed-off-by: Michael Adam --- source3/lib/netapi/serverinfo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index e995bdaf47..f321648f24 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -573,8 +573,15 @@ static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx, goto done; } - werr = smbconf_set_global_parameter(conf_ctx, "server string", + err = smbconf_set_global_parameter(conf_ctx, "server string", info1005->comment); + if (!SBC_ERROR_IS_OK(err)) { + libnetapi_set_error_string(ctx, + "Could not set global parameter: %s", + sbcErrorString(err)); + werr = WERR_NO_SUCH_SERVICE; + goto done; + } done: smbconf_shutdown(conf_ctx); -- cgit From 04c101e873bd758fae6b7131551f6069ab2fcce3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 13 May 2011 00:15:41 +0200 Subject: s3-libnetapi/libnetjoin: fix uninitialized variables after the libsmbconf changes. Guenther --- source3/lib/netapi/serverinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index f321648f24..8f76b4a63e 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -540,7 +540,7 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx, static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx, struct NetServerSetInfo *r) { - WERROR werr; + WERROR werr = WERR_OK; sbcErr err; struct smbconf_ctx *conf_ctx; struct srvsvc_NetSrvInfo1005 *info1005; -- cgit From a37de9a95974c138d264d9cb0c7829bb426bb2d6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 10 May 2011 22:08:36 +0200 Subject: s3-libnetapi Don't create a talloc_stackframe() in a global variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also ensures that libnetapi_free() invalidates the global stat_ctx variable, and changes the API so that the behaviour of the error string routines is to consistently return a allocated string. Pair-Programmed-With: Günther Deschner Andrew Bartlett --- source3/lib/netapi/netapi.c | 44 +++++++++++++++++++++++++++++++------------- source3/lib/netapi/netapi.h | 9 ++++++--- 2 files changed, 37 insertions(+), 16 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index cd590273ce..255e0930b8 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -24,7 +24,6 @@ #include "krb5_env.h" struct libnetapi_ctx *stat_ctx = NULL; -TALLOC_CTX *frame = NULL; static bool libnetapi_initialized = false; /**************************************************************** @@ -57,6 +56,8 @@ were not expecting it. NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) { + NET_API_STATUS ret; + TALLOC_CTX *frame; if (stat_ctx && libnetapi_initialized) { *context = stat_ctx; return NET_API_STATUS_SUCCESS; @@ -88,7 +89,9 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) BlockSignals(True, SIGPIPE); - return libnetapi_net_init(context); + ret = libnetapi_net_init(context); + TALLOC_FREE(frame); + return ret; } /**************************************************************** @@ -105,7 +108,7 @@ NET_API_STATUS libnetapi_net_init(struct libnetapi_ctx **context) struct libnetapi_ctx *ctx = NULL; char *krb5_cc_env = NULL; - frame = talloc_stackframe(); + TALLOC_CTX *frame = talloc_stackframe(); ctx = talloc_zero(frame, struct libnetapi_ctx); if (!ctx) { @@ -117,14 +120,14 @@ NET_API_STATUS libnetapi_net_init(struct libnetapi_ctx **context) krb5_cc_env = getenv(KRB5_ENV_CCNAME); if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) { - ctx->krb5_cc_env = talloc_strdup(frame, "MEMORY:libnetapi"); + ctx->krb5_cc_env = talloc_strdup(ctx, "MEMORY:libnetapi"); setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1); } if (getenv("USER")) { - ctx->username = talloc_strdup(frame, getenv("USER")); + ctx->username = talloc_strdup(ctx, getenv("USER")); } else { - ctx->username = talloc_strdup(frame, ""); + ctx->username = talloc_strdup(ctx, ""); } if (!ctx->username) { TALLOC_FREE(frame); @@ -140,8 +143,10 @@ NET_API_STATUS libnetapi_net_init(struct libnetapi_ctx **context) libnetapi_initialized = true; + talloc_steal(NULL, ctx); *context = stat_ctx = ctx; - + + TALLOC_FREE(frame); return NET_API_STATUS_SUCCESS; } @@ -187,8 +192,10 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) secrets_shutdown(); + if (ctx == stat_ctx) { + stat_ctx = NULL; + } TALLOC_FREE(ctx); - TALLOC_FREE(frame); gfree_debugsyms(); @@ -202,10 +209,14 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel) { + TALLOC_CTX *frame = talloc_stackframe(); ctx->debuglevel = talloc_strdup(ctx, debuglevel); + if (!lp_set_cmdline("log level", debuglevel)) { + TALLOC_FREE(frame); return W_ERROR_V(WERR_GENERAL_FAILURE); } + TALLOC_FREE(frame); return NET_API_STATUS_SUCCESS; } @@ -272,15 +283,21 @@ NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx) } /**************************************************************** +Return a libnetapi error as a string, caller must free with NetApiBufferFree ****************************************************************/ -const char *libnetapi_errstr(NET_API_STATUS status) +char *libnetapi_errstr(NET_API_STATUS status) { + TALLOC_CTX *frame = talloc_stackframe(); + char *ret; if (status & 0xc0000000) { - return get_friendly_nt_error_msg(NT_STATUS(status)); + ret = talloc_strdup(NULL, + get_friendly_nt_error_msg(NT_STATUS(status))); } - return get_friendly_werror_msg(W_ERROR(status)); + ret = talloc_strdup(NULL, get_friendly_werror_msg(W_ERROR(status))); + TALLOC_FREE(frame); + return ret; } /**************************************************************** @@ -304,9 +321,10 @@ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, } /**************************************************************** +Return a libnetapi_errstr(), caller must free with NetApiBufferFree ****************************************************************/ -const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, +char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status_in) { NET_API_STATUS status; @@ -320,7 +338,7 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, } if (tmp_ctx->error_string) { - return tmp_ctx->error_string; + return talloc_strdup(NULL, tmp_ctx->error_string); } return libnetapi_errstr(status_in); diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 9e1549df0e..620d8cf591 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -1411,15 +1411,18 @@ NET_API_STATUS libnetapi_set_use_kerberos(struct libnetapi_ctx *ctx); NET_API_STATUS libnetapi_set_use_ccache(struct libnetapi_ctx *ctx); /**************************************************************** +Return a specific libnetapi error as a string, caller must free with NetApiBufferFree ****************************************************************/ -const char *libnetapi_errstr(NET_API_STATUS status); +char *libnetapi_errstr(NET_API_STATUS status); /**************************************************************** +Return the last libnetapi error as a string, caller must free with NetApiBufferFree +ctx is optional ****************************************************************/ -const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, - NET_API_STATUS status); +char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, + NET_API_STATUS status); /**************************************************************** NetApiBufferAllocate -- cgit From ef2a7c653808a5e0abdd87dc74579bb6c006b730 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 10 May 2011 22:11:55 +0200 Subject: s3-netapi Initialise global variables in libnetapi It is important to initalise the global variables when loading this configuration for the potentially first time. Andrew Bartlett --- source3/lib/netapi/netapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 255e0930b8..06e353d6ce 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -77,7 +77,7 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) lp_set_cmdline("log level", "0"); setup_logging("libnetapi", DEBUG_STDERR); - if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { + if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, true)) { TALLOC_FREE(frame); fprintf(stderr, "error loading %s\n", get_dyn_CONFIGFILE() ); return W_ERROR_V(WERR_GENERAL_FAILURE); -- cgit From af9afe9f4fc21b9c800bb14c65cbfecb155d3519 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 20 May 2011 13:25:31 +0200 Subject: s3: Fix Coverity ID 2573: UNUSED_VALUE Andrew B., please check! --- source3/lib/netapi/netapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 06e353d6ce..1d34934565 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -293,9 +293,10 @@ char *libnetapi_errstr(NET_API_STATUS status) if (status & 0xc0000000) { ret = talloc_strdup(NULL, get_friendly_nt_error_msg(NT_STATUS(status))); + } else { + ret = talloc_strdup(NULL, + get_friendly_werror_msg(W_ERROR(status))); } - - ret = talloc_strdup(NULL, get_friendly_werror_msg(W_ERROR(status))); TALLOC_FREE(frame); return ret; } -- cgit From 508e1607764d993c4d9a84793ffb7cfd22357f91 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 30 May 2011 16:26:17 +0200 Subject: s3: fix some -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: Mon May 30 17:41:18 CEST 2011 on sn-devel-104 --- source3/lib/netapi/user.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 7831e20a0a..28619a0e44 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -3137,7 +3137,6 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, size_t num_del_rids = 0; uint32_t *member_rids = NULL; - size_t num_member_rids = 0; struct GROUP_USERS_INFO_0 *i0 = NULL; struct GROUP_USERS_INFO_1 *i1 = NULL; @@ -3263,7 +3262,6 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, } member_rids = group_rids.ids; - num_member_rids = group_rids.count; status = dcerpc_samr_GetGroupsForUser(b, talloc_tos(), &user_handle, -- 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/lib/netapi/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 28619a0e44..f1182100c7 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -3572,7 +3572,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } sid_array.num_sids = rid_array->count + 1; - sid_array.sids = TALLOC_ARRAY(ctx, struct lsa_SidPtr, sid_array.num_sids); + sid_array.sids = talloc_array(ctx, struct lsa_SidPtr, sid_array.num_sids); if (!sid_array.sids) { werr = WERR_NOMEM; goto done; -- 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/lib/netapi/share.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/share.c b/source3/lib/netapi/share.c index c4ed1549ce..d12fa1cf0c 100644 --- a/source3/lib/netapi/share.c +++ b/source3/lib/netapi/share.c @@ -141,7 +141,7 @@ static NTSTATUS map_SHARE_INFO_buffer_to_srvsvc_share_info(TALLOC_CTX *mem_ctx, case 2: i2 = (struct SHARE_INFO_2 *)buffer; - s2 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo2); + s2 = talloc(mem_ctx, struct srvsvc_NetShareInfo2); NT_STATUS_HAVE_NO_MEMORY(s2); s2->name = i2->shi2_netname; @@ -159,7 +159,7 @@ static NTSTATUS map_SHARE_INFO_buffer_to_srvsvc_share_info(TALLOC_CTX *mem_ctx, case 1004: i1004 = (struct SHARE_INFO_1004 *)buffer; - s1004 = TALLOC_P(mem_ctx, struct srvsvc_NetShareInfo1004); + s1004 = talloc(mem_ctx, struct srvsvc_NetShareInfo1004); NT_STATUS_HAVE_NO_MEMORY(s1004); s1004->comment = i1004->shi1004_remark; -- 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/lib/netapi/cm.c | 2 +- source3/lib/netapi/localgroup.c | 2 +- source3/lib/netapi/netapi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index 4c9bfcb419..3adb97e357 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -122,7 +122,7 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx, return WERR_CAN_NOT_COMPLETE; } - p = TALLOC_ZERO_P(ctx, struct client_ipc_connection); + p = talloc_zero(ctx, struct client_ipc_connection); if (p == NULL) { return WERR_NOMEM; } diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c index 49ba74ec17..54ec14eb84 100644 --- a/source3/lib/netapi/localgroup.c +++ b/source3/lib/netapi/localgroup.c @@ -610,7 +610,7 @@ static WERROR map_buffer_to_alias_info(TALLOC_CTX *mem_ctx, struct LOCALGROUP_INFO_1002 *info1002; union samr_AliasInfo *info = NULL; - info = TALLOC_ZERO_P(mem_ctx, union samr_AliasInfo); + info = talloc_zero(mem_ctx, union samr_AliasInfo); W_ERROR_HAVE_NO_MEMORY(info); switch (level) { diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 1d34934565..14259864ae 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -37,7 +37,7 @@ static NET_API_STATUS libnetapi_init_private_context(struct libnetapi_ctx *ctx) return W_ERROR_V(WERR_INVALID_PARAM); } - priv = TALLOC_ZERO_P(ctx, struct libnetapi_private_ctx); + priv = talloc_zero(ctx, struct libnetapi_private_ctx); if (!priv) { return W_ERROR_V(WERR_NOMEM); } -- 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/lib/netapi/cm.c | 2 +- source3/lib/netapi/group.c | 8 ++++---- source3/lib/netapi/localgroup.c | 2 +- source3/lib/netapi/user.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c index 3adb97e357..47ccf8bb7a 100644 --- a/source3/lib/netapi/cm.c +++ b/source3/lib/netapi/cm.c @@ -188,7 +188,7 @@ static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx, struct client_pipe_connection *p; NTSTATUS status; - p = TALLOC_ZERO_ARRAY(mem_ctx, struct client_pipe_connection, 1); + p = talloc_zero_array(mem_ctx, struct client_pipe_connection, 1); if (!p) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/lib/netapi/group.c b/source3/lib/netapi/group.c index 4295d9f7bb..710ec3790f 100644 --- a/source3/lib/netapi/group.c +++ b/source3/lib/netapi/group.c @@ -1157,7 +1157,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_0_buffer(TALLOC_CTX *mem_ct struct GROUP_INFO_0 *g0; int i; - g0 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_0, groups->count); + g0 = talloc_zero_array(mem_ctx, struct GROUP_INFO_0, groups->count); W_ERROR_HAVE_NO_MEMORY(g0); for (i=0; icount; i++) { @@ -1183,7 +1183,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_1_buffer(TALLOC_CTX *mem_ct struct GROUP_INFO_1 *g1; int i; - g1 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_1, groups->count); + g1 = talloc_zero_array(mem_ctx, struct GROUP_INFO_1, groups->count); W_ERROR_HAVE_NO_MEMORY(g1); for (i=0; icount; i++) { @@ -1211,7 +1211,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_2_buffer(TALLOC_CTX *mem_ct struct GROUP_INFO_2 *g2; int i; - g2 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_2, groups->count); + g2 = talloc_zero_array(mem_ctx, struct GROUP_INFO_2, groups->count); W_ERROR_HAVE_NO_MEMORY(g2); for (i=0; icount; i++) { @@ -1242,7 +1242,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_3_buffer(TALLOC_CTX *mem_ct struct GROUP_INFO_3 *g3; int i; - g3 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_3, groups->count); + g3 = talloc_zero_array(mem_ctx, struct GROUP_INFO_3, groups->count); W_ERROR_HAVE_NO_MEMORY(g3); for (i=0; icount; i++) { diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c index 54ec14eb84..816afc230f 100644 --- a/source3/lib/netapi/localgroup.c +++ b/source3/lib/netapi/localgroup.c @@ -1115,7 +1115,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, ZERO_STRUCT(domain_handle); ZERO_STRUCT(alias_handle); - member_sids = TALLOC_ZERO_ARRAY(ctx, struct dom_sid, + member_sids = talloc_zero_array(ctx, struct dom_sid, r->in.total_entries); W_ERROR_HAVE_NO_MEMORY(member_sids); diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index f1182100c7..3003a39397 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -1436,7 +1436,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_USER(TALLOC_CTX *mem_ctx, struct NET_DISPLAY_USER *user = NULL; int i; - user = TALLOC_ZERO_ARRAY(mem_ctx, + user = talloc_zero_array(mem_ctx, struct NET_DISPLAY_USER, info->count); W_ERROR_HAVE_NO_MEMORY(user); @@ -1480,7 +1480,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_MACHINE(TALLOC_CTX *mem_ctx, struct NET_DISPLAY_MACHINE *machine = NULL; int i; - machine = TALLOC_ZERO_ARRAY(mem_ctx, + machine = talloc_zero_array(mem_ctx, struct NET_DISPLAY_MACHINE, info->count); W_ERROR_HAVE_NO_MEMORY(machine); @@ -1522,7 +1522,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_GROUP(TALLOC_CTX *mem_ctx, struct NET_DISPLAY_GROUP *group = NULL; int i; - group = TALLOC_ZERO_ARRAY(mem_ctx, + group = talloc_zero_array(mem_ctx, struct NET_DISPLAY_GROUP, info->count); W_ERROR_HAVE_NO_MEMORY(group); -- 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/lib/netapi/serverinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 8f76b4a63e..34db569cd7 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -36,7 +36,7 @@ static WERROR NetServerGetInfo_l_101(struct libnetapi_ctx *ctx, struct SERVER_INFO_101 i; i.sv101_platform_id = PLATFORM_ID_NT; - i.sv101_name = global_myname(); + i.sv101_name = lp_netbios_name(); i.sv101_version_major = lp_major_announce_version(); i.sv101_version_minor = lp_minor_announce_version(); i.sv101_type = lp_default_server_announce(); -- cgit From 387ddc2c295e92363c83dcd29353cdd4c56984ab Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Jun 2011 15:04:48 +0200 Subject: source3/lib/netapi/libnetapi.h: fix licence/copyright Guenther --- source3/lib/netapi/libnetapi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/libnetapi.h b/source3/lib/netapi/libnetapi.h index 2711558dbc..e832deaccc 100644 --- a/source3/lib/netapi/libnetapi.h +++ b/source3/lib/netapi/libnetapi.h @@ -1,3 +1,22 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Support + * Copyright (C) Guenther Deschner 2007-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 . + */ + #ifndef __LIBNETAPI_LIBNETAPI__ #define __LIBNETAPI_LIBNETAPI__ NET_API_STATUS NetJoinDomain(const char * server /* [in] [unique] */, -- 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/lib/netapi/serverinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 34db569cd7..4b11339f94 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -37,8 +37,8 @@ static WERROR NetServerGetInfo_l_101(struct libnetapi_ctx *ctx, i.sv101_platform_id = PLATFORM_ID_NT; i.sv101_name = lp_netbios_name(); - i.sv101_version_major = lp_major_announce_version(); - i.sv101_version_minor = lp_minor_announce_version(); + i.sv101_version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION; + i.sv101_version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION; i.sv101_type = lp_default_server_announce(); i.sv101_comment = lp_serverstring(); -- cgit