From 82f96542fa457b57bd7e7a4db69b950f6f025cca Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 25 Jul 2005 02:23:41 +0000 Subject: r8744: Split 'net samdump' out into a separate file Work on the talloc memory tree, as I think talloc_reference and other things were biting me. Crush unions in the name of code reform. ;-) Andrew Bartlett (This used to be commit 2eadcf46699f1cc7adb2066e17096f70c7b73998) --- source4/libnet/libnet_samdump.c | 232 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 source4/libnet/libnet_samdump.c (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c new file mode 100644 index 0000000000..ecedc0264f --- /dev/null +++ b/source4/libnet/libnet_samdump.c @@ -0,0 +1,232 @@ +/* + Unix SMB/CIFS implementation. + + Extract the user/system database from a remote SamSync server + + Copyright (C) Andrew Bartlett 2004-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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include "includes.h" +#include "libnet/libnet.h" +#include "librpc/gen_ndr/ndr_netlogon.h" +#include "librpc/gen_ndr/ndr_samr.h" +#include "dlinklist.h" + + +struct samdump_secret { + struct samdump_secret *prev, *next; + DATA_BLOB secret; + char *name; + NTTIME mtime; +}; + +struct samdump_trusted_domain { + struct samdump_trusted_domain *prev, *next; + struct dom_sid *sid; + char *name; +}; + +struct samdump_state { + struct samdump_secret *secrets; + struct samdump_trusted_domain *trusted_domains; +}; + +static NTSTATUS vampire_samdump_handle_user(TALLOC_CTX *mem_ctx, + struct creds_CredentialState *creds, + struct netr_DELTA_ENUM *delta) +{ + uint32_t rid = delta->delta_id_union.rid; + struct netr_DELTA_USER *user = delta->delta_union.user; + const char *username = user->account_name.string; + char *hex_lm_password; + char *hex_nt_password; + + hex_lm_password = smbpasswd_sethexpwd(mem_ctx, + user->lm_password_present ? &user->lmpassword : NULL, + user->acct_flags); + hex_nt_password = smbpasswd_sethexpwd(mem_ctx, + user->nt_password_present ? &user->ntpassword : NULL, + user->acct_flags); + + printf("%s:%d:%s:%s:%s:LCT-%08X\n", username, + rid, hex_lm_password, hex_nt_password, + smbpasswd_encode_acb_info(mem_ctx, user->acct_flags), + (unsigned int)nt_time_to_unix(user->last_password_change)); + + return NT_STATUS_OK; +} + +static NTSTATUS vampire_samdump_handle_secret(TALLOC_CTX *mem_ctx, + struct samdump_state *samdump_state, + struct creds_CredentialState *creds, + struct netr_DELTA_ENUM *delta) +{ + struct netr_DELTA_SECRET *secret = delta->delta_union.secret; + const char *name = delta->delta_id_union.name; + struct samdump_secret *new = talloc(samdump_state, struct samdump_secret); + + new->name = talloc_steal(new, name); + new->secret = data_blob_talloc(new, secret->current_cipher.cipher_data, secret->current_cipher.maxlen); + new->mtime = secret->current_cipher_set_time; + + DLIST_ADD(samdump_state->secrets, new); + + return NT_STATUS_OK; +} + +static NTSTATUS vampire_samdump_handle_trusted_domain(TALLOC_CTX *mem_ctx, + struct samdump_state *samdump_state, + struct creds_CredentialState *creds, + struct netr_DELTA_ENUM *delta) +{ + struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain; + struct dom_sid *dom_sid = delta->delta_id_union.sid; + + struct samdump_trusted_domain *new = talloc(samdump_state, struct samdump_trusted_domain); + + new->name = talloc_steal(new, trusted_domain->domain_name.string); + new->sid = talloc_steal(new, dom_sid); + + DLIST_ADD(samdump_state->trusted_domains, new); + + return NT_STATUS_OK; +} + +static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, + void *private, + struct creds_CredentialState *creds, + enum netr_SamDatabaseID database, + struct netr_DELTA_ENUM *delta, + char **error_string) +{ + NTSTATUS nt_status = NT_STATUS_OK; + struct samdump_state *samdump_state = private; + + *error_string = NULL; + switch (delta->delta_type) { + case NETR_DELTA_USER: + { + /* not interested in builtin users */ + if (database == SAM_DATABASE_DOMAIN) { + nt_status = vampire_samdump_handle_user(mem_ctx, + creds, + delta); + break; + } + } + case NETR_DELTA_SECRET: + { + nt_status = vampire_samdump_handle_secret(mem_ctx, + samdump_state, + creds, + delta); + break; + } + case NETR_DELTA_TRUSTED_DOMAIN: + { + nt_status = vampire_samdump_handle_trusted_domain(mem_ctx, + samdump_state, + creds, + delta); + break; + } + default: + /* Can't dump them all right now */ + break; + } + return nt_status; +} + +static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) +{ + NTSTATUS nt_status; + struct libnet_SamSync r2; + struct samdump_state *samdump_state = talloc(mem_ctx, struct samdump_state); + + struct samdump_trusted_domain *t; + struct samdump_secret *s; + + if (!samdump_state) { + return NT_STATUS_NO_MEMORY; + } + + samdump_state->secrets = NULL; + samdump_state->trusted_domains = NULL; + + r2.error_string = NULL; + r2.delta_fn = libnet_samdump_fn; + r2.fn_ctx = samdump_state; + r2.machine_account = NULL; /* TODO: Create a machine account, fill this in, and the delete it */ + nt_status = libnet_SamSync_netlogon(ctx, samdump_state, &r2); + r->error_string = r2.error_string; + + if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(samdump_state); + return nt_status; + } + + printf("Trusted domains, sids and secrets:\n"); + for (t=samdump_state->trusted_domains; t; t=t->next) { + char *secret_name = talloc_asprintf(mem_ctx, "G$$%s", t->name); + for (s=samdump_state->secrets; s; s=s->next) { + if (StrCaseCmp(s->name, secret_name) == 0) { + char *secret_string; + if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, + s->secret.data, s->secret.length, + (void **)&secret_string) == -1) { + r->error_string = talloc_asprintf(mem_ctx, + "Could not convert secret for domain %s to a string\n", + t->name); + talloc_free(samdump_state); + return NT_STATUS_INVALID_PARAMETER; + } + printf("%s\t%s\t%s\n", + t->name, dom_sid_string(mem_ctx, t->sid), + secret_string); + } + } + } + talloc_free(samdump_state); + return nt_status; +} + + + +static NTSTATUS libnet_SamDump_generic(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) +{ + NTSTATUS nt_status; + struct libnet_SamDump r2; + r2.level = LIBNET_SAMDUMP_NETLOGON; + r2.error_string = NULL; + nt_status = libnet_SamDump(ctx, mem_ctx, &r2); + r->error_string = r2.error_string; + + return nt_status; +} + +NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) +{ + switch (r->level) { + case LIBNET_SAMDUMP_GENERIC: + return libnet_SamDump_generic(ctx, mem_ctx, r); + case LIBNET_SAMDUMP_NETLOGON: + return libnet_SamDump_netlogon(ctx, mem_ctx, r); + } + + return NT_STATUS_INVALID_LEVEL; +} -- cgit From b674411eb46c9e45f2740a1f9bac365e9a347e9c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 30 Aug 2005 11:55:05 +0000 Subject: r9792: Rename StrCaseCmp -> strcasecmp_m. All these years I was thinking StrCaseCmp was sys_strcasecmp, while it is in fact strcasecmp_m! (This used to be commit 200a8f6652cb2de7a8037a7a4c2a204b50aee2b1) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index ecedc0264f..8936407972 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -184,7 +184,7 @@ static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX * for (t=samdump_state->trusted_domains; t; t=t->next) { char *secret_name = talloc_asprintf(mem_ctx, "G$$%s", t->name); for (s=samdump_state->secrets; s; s=s->next) { - if (StrCaseCmp(s->name, secret_name) == 0) { + if (strcasecmp_m(s->name, secret_name) == 0) { char *secret_string; if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/libnet/libnet_samdump.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 8936407972..a5d060c5eb 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -23,8 +23,6 @@ #include "includes.h" #include "libnet/libnet.h" -#include "librpc/gen_ndr/ndr_netlogon.h" -#include "librpc/gen_ndr/ndr_samr.h" #include "dlinklist.h" -- cgit From 63d718e243fd03e6ea24c47e7442975ec088a5b5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 17:27:33 +0000 Subject: r12696: Reduce the size of include/structs.h (This used to be commit 63917616016133c623fc6ff59454bc313ee7dd8f) --- source4/libnet/libnet_samdump.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index a5d060c5eb..52513fa1b1 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -24,6 +24,7 @@ #include "includes.h" #include "libnet/libnet.h" #include "dlinklist.h" +#include "samba3/samba3.h" struct samdump_secret { -- cgit From a5a79e8b8cbdf24d5c2db45ece4110ed5d85e58f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 12 Jan 2006 09:33:49 +0000 Subject: r12865: Upgrade the librpc and libnet code. In librpc, always try SMB level authentication, even if trying schannel, but allow fallback to anonymous. This should better function with servers that set restrict anonymous. There are too many parts of Samba that get, parse and modify the binding parameters. Avoid the extra work, and add a binding element to the struct dcerpc_pipe The libnet vampire code has been refactored, to reduce extra layers and to better conform with the standard argument pattern. Also, take advantage of the new libnet_Lookup code, so we don't require the silly 'password server' smb.conf parameter. To better support forcing traffic to be sealed for the vampire operation, the dcerpc_bind_auth() function now takes an auth level parameter. Andrew Bartlett (This used to be commit d65b354959842326fdd4bd7eb7fbeea0390f4afa) --- source4/libnet/libnet_samdump.c | 71 ++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 47 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 52513fa1b1..e094293916 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -151,7 +151,7 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, return nt_status; } -static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) +NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) { NTSTATUS nt_status; struct libnet_SamSync r2; @@ -164,15 +164,16 @@ static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX * return NT_STATUS_NO_MEMORY; } - samdump_state->secrets = NULL; + samdump_state->secrets = NULL; samdump_state->trusted_domains = NULL; - r2.error_string = NULL; - r2.delta_fn = libnet_samdump_fn; - r2.fn_ctx = samdump_state; - r2.machine_account = NULL; /* TODO: Create a machine account, fill this in, and the delete it */ - nt_status = libnet_SamSync_netlogon(ctx, samdump_state, &r2); - r->error_string = r2.error_string; + r2.out.error_string = NULL; + r2.in.binding_string = r->in.binding_string; + r2.in.delta_fn = libnet_samdump_fn; + r2.in.fn_ctx = samdump_state; + r2.in.machine_account = r->in.machine_account; + nt_status = libnet_SamSync_netlogon(ctx, samdump_state, &r2); + r->out.error_string = r2.out.error_string; if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(samdump_state); @@ -183,49 +184,25 @@ static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX * for (t=samdump_state->trusted_domains; t; t=t->next) { char *secret_name = talloc_asprintf(mem_ctx, "G$$%s", t->name); for (s=samdump_state->secrets; s; s=s->next) { - if (strcasecmp_m(s->name, secret_name) == 0) { - char *secret_string; - if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, - s->secret.data, s->secret.length, - (void **)&secret_string) == -1) { - r->error_string = talloc_asprintf(mem_ctx, - "Could not convert secret for domain %s to a string\n", - t->name); - talloc_free(samdump_state); - return NT_STATUS_INVALID_PARAMETER; - } - printf("%s\t%s\t%s\n", - t->name, dom_sid_string(mem_ctx, t->sid), - secret_string); + char *secret_string; + if (strcasecmp_m(s->name, secret_name) != 0) { + continue; + } + if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, + s->secret.data, s->secret.length, + (void **)&secret_string) == -1) { + r->out.error_string = talloc_asprintf(mem_ctx, + "Could not convert secret for domain %s to a string\n", + t->name); + talloc_free(samdump_state); + return NT_STATUS_INVALID_PARAMETER; } + printf("%s\t%s\t%s\n", + t->name, dom_sid_string(mem_ctx, t->sid), + secret_string); } } talloc_free(samdump_state); return nt_status; } - - -static NTSTATUS libnet_SamDump_generic(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) -{ - NTSTATUS nt_status; - struct libnet_SamDump r2; - r2.level = LIBNET_SAMDUMP_NETLOGON; - r2.error_string = NULL; - nt_status = libnet_SamDump(ctx, mem_ctx, &r2); - r->error_string = r2.error_string; - - return nt_status; -} - -NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) -{ - switch (r->level) { - case LIBNET_SAMDUMP_GENERIC: - return libnet_SamDump_generic(ctx, mem_ctx, r); - case LIBNET_SAMDUMP_NETLOGON: - return libnet_SamDump_netlogon(ctx, mem_ctx, r); - } - - return NT_STATUS_INVALID_LEVEL; -} -- cgit From b15582ed816f3d477f978976f43b82cfa90bf6dc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 13 Jan 2006 12:52:56 +0000 Subject: r12903: Factor out a new routine libnet_RpcConnectDCInfo, to both connect to the remote sever, and to query it for domain information. Provide and use this information in the SamSync/Vampire callbacks, to allow a parallel connection to LDAP, if we are talking to AD. This allows us to get at some important attributes not exposed in the old protocol. With this, we are able to do a all-GUI vampire of a AD domain from SWAT, including getting all the SIDs, servicePrincipalNames and the like correct. Andrew Bartlett (This used to be commit 918358cee0b4a1b2c9bc9e68d9d53428a634281e) --- source4/libnet/libnet_samdump.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index e094293916..8936d6829a 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -46,7 +46,6 @@ struct samdump_state { }; static NTSTATUS vampire_samdump_handle_user(TALLOC_CTX *mem_ctx, - struct creds_CredentialState *creds, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; @@ -72,7 +71,6 @@ static NTSTATUS vampire_samdump_handle_user(TALLOC_CTX *mem_ctx, static NTSTATUS vampire_samdump_handle_secret(TALLOC_CTX *mem_ctx, struct samdump_state *samdump_state, - struct creds_CredentialState *creds, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_SECRET *secret = delta->delta_union.secret; @@ -90,7 +88,6 @@ static NTSTATUS vampire_samdump_handle_secret(TALLOC_CTX *mem_ctx, static NTSTATUS vampire_samdump_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samdump_state *samdump_state, - struct creds_CredentialState *creds, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain; @@ -108,7 +105,6 @@ static NTSTATUS vampire_samdump_handle_trusted_domain(TALLOC_CTX *mem_ctx, static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, void *private, - struct creds_CredentialState *creds, enum netr_SamDatabaseID database, struct netr_DELTA_ENUM *delta, char **error_string) @@ -123,7 +119,6 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, /* not interested in builtin users */ if (database == SAM_DATABASE_DOMAIN) { nt_status = vampire_samdump_handle_user(mem_ctx, - creds, delta); break; } @@ -132,7 +127,6 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, { nt_status = vampire_samdump_handle_secret(mem_ctx, samdump_state, - creds, delta); break; } @@ -140,7 +134,6 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, { nt_status = vampire_samdump_handle_trusted_domain(mem_ctx, samdump_state, - creds, delta); break; } @@ -169,11 +162,13 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct r2.out.error_string = NULL; r2.in.binding_string = r->in.binding_string; + r2.in.init_fn = NULL; r2.in.delta_fn = libnet_samdump_fn; r2.in.fn_ctx = samdump_state; r2.in.machine_account = r->in.machine_account; nt_status = libnet_SamSync_netlogon(ctx, samdump_state, &r2); r->out.error_string = r2.out.error_string; + talloc_steal(mem_ctx, r->out.error_string); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(samdump_state); -- cgit From 8528016978b084213ef53d66e1b6e831b1a01acc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 16 Mar 2006 00:23:11 +0000 Subject: r14464: Don't include ndr_BASENAME.h files unless strictly required, instead try to include just the BASENAME.h files (containing only structs) (This used to be commit 3dd477ca5147f28a962b8437e2611a8222d706bd) --- source4/libnet/libnet_samdump.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 8936d6829a..0f97263b47 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -25,6 +25,7 @@ #include "libnet/libnet.h" #include "dlinklist.h" #include "samba3/samba3.h" +#include "librpc/gen_ndr/ndr_security.h" struct samdump_secret { -- cgit From e002300f238dd0937dd9f768e366c006945e8baa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Apr 2006 17:34:49 +0000 Subject: r15328: Move some functions around, remove dependencies. Remove some autogenerated headers (which had prototypes now autogenerated by pidl) Remove ndr_security.h from a few places - it's no longer necessary (This used to be commit c19c2b51d3e1ad347120b06a22bda5ec586c22e8) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 0f97263b47..63c356d52d 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -25,7 +25,7 @@ #include "libnet/libnet.h" #include "dlinklist.h" #include "samba3/samba3.h" -#include "librpc/gen_ndr/ndr_security.h" +#include "libcli/security/security.h" struct samdump_secret { -- cgit From 12dc0ae78cfc179d3e087f789ce5fb499cf5a29a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 6 Jul 2006 05:55:26 +0000 Subject: r16830: Fix IBM checker and GCC warnings. Andrew Bartlett (This used to be commit 5ef924bc739a51a8f83d7b4566f9ba85296c585a) --- source4/libnet/libnet_samdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 63c356d52d..668246729e 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -78,7 +78,7 @@ static NTSTATUS vampire_samdump_handle_secret(TALLOC_CTX *mem_ctx, const char *name = delta->delta_id_union.name; struct samdump_secret *new = talloc(samdump_state, struct samdump_secret); - new->name = talloc_steal(new, name); + new->name = talloc_strdup(new, name); new->secret = data_blob_talloc(new, secret->current_cipher.cipher_data, secret->current_cipher.maxlen); new->mtime = secret->current_cipher_set_time; @@ -96,7 +96,7 @@ static NTSTATUS vampire_samdump_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samdump_trusted_domain *new = talloc(samdump_state, struct samdump_trusted_domain); - new->name = talloc_steal(new, trusted_domain->domain_name.string); + new->name = talloc_strdup(new, trusted_domain->domain_name.string); new->sid = talloc_steal(new, dom_sid); DLIST_ADD(samdump_state->trusted_domains, new); @@ -121,8 +121,8 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, if (database == SAM_DATABASE_DOMAIN) { nt_status = vampire_samdump_handle_user(mem_ctx, delta); - break; } + break; } case NETR_DELTA_SECRET: { -- cgit From 0329d755a7611ba3897fc1ee9bdce410cc33d7f8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 30 Aug 2006 11:29:34 +0000 Subject: r17930: Merge noinclude branch: * Move dlinklist.h, smb.h to subsystem-specific directories * Clean up ads.h and move what is left of it to dsdb/ (only place where it's used) (This used to be commit f7afa1cb77f3cfa7020b57de12e6003db7cfcc42) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 668246729e..a8b5c39f96 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -23,7 +23,7 @@ #include "includes.h" #include "libnet/libnet.h" -#include "dlinklist.h" +#include "lib/util/dlinklist.h" #include "samba3/samba3.h" #include "libcli/security/security.h" -- cgit From e7ede84c331b112efa5232d0f7dcc6732b95aebe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Sep 2006 09:54:44 +0000 Subject: r18609: error_string should not contain newlines. Guenther (This used to be commit 556666756418ad50c533199c736fe3696a7e20cb) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index a8b5c39f96..8ece324741 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -188,7 +188,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct s->secret.data, s->secret.length, (void **)&secret_string) == -1) { r->out.error_string = talloc_asprintf(mem_ctx, - "Could not convert secret for domain %s to a string\n", + "Could not convert secret for domain %s to a string", t->name); talloc_free(samdump_state); return NT_STATUS_INVALID_PARAMETER; -- cgit From eee140d7da8088884c392ebefbef3ad3650aceb0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 12 Feb 2007 13:34:04 +0000 Subject: r21300: let the caller decide if it wants rid decrypted hashes or not metze (This used to be commit 8711d01ffd080c43512b88b995daf2d6b7c06ba1) --- source4/libnet/libnet_samdump.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 8ece324741..7953454616 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -163,6 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct r2.out.error_string = NULL; r2.in.binding_string = r->in.binding_string; + r2.in.rid_crypt = lp_parm_bool(-1, "vampire", "rid decrypt", True); r2.in.init_fn = NULL; r2.in.delta_fn = libnet_samdump_fn; r2.in.fn_ctx = samdump_state; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libnet/libnet_samdump.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 7953454616..fb4267748a 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, @@ -16,8 +16,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ -- cgit From 959915a8cbea0c598ef1f29ce666329a521ef2f6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 15:35:18 +0000 Subject: r25001: Fix more C++ and other warnings, fix some of the indentation with ts=4 lines that I accidently added earlier. (This used to be commit 0bcb21ed740fcec0f48ad36bbc2deee2948e8fc7) --- source4/libnet/libnet_samdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index fb4267748a..fc671a9b48 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -144,7 +144,8 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, return nt_status; } -NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamDump *r) +NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, + struct libnet_SamDump *r) { NTSTATUS nt_status; struct libnet_SamSync r2; -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/libnet/libnet_samdump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index fc671a9b48..bde5a29cb9 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -110,7 +110,7 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx, char **error_string) { NTSTATUS nt_status = NT_STATUS_OK; - struct samdump_state *samdump_state = private; + struct samdump_state *samdump_state = (struct samdump_state *)private; *error_string = NULL; switch (delta->delta_type) { @@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, r2.out.error_string = NULL; r2.in.binding_string = r->in.binding_string; - r2.in.rid_crypt = lp_parm_bool(-1, "vampire", "rid decrypt", True); + r2.in.rid_crypt = lp_parm_bool(NULL, "vampire", "rid decrypt", true); r2.in.init_fn = NULL; r2.in.delta_fn = libnet_samdump_fn; r2.in.fn_ctx = samdump_state; -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index bde5a29cb9..5c7266d7a8 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, r2.out.error_string = NULL; r2.in.binding_string = r->in.binding_string; - r2.in.rid_crypt = lp_parm_bool(NULL, "vampire", "rid decrypt", true); + r2.in.rid_crypt = lp_parm_bool(global_loadparm, NULL, "vampire", "rid decrypt", true); r2.in.init_fn = NULL; r2.in.delta_fn = libnet_samdump_fn; r2.in.fn_ctx = samdump_state; -- cgit From 39ee38d9c1aabf4db065b433d067d0da053d7d61 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 17:52:23 +0100 Subject: r26316: Use contexts for conversion functions. (This used to be commit f6420d933b5b011d428974f3a2a57edf19e6f482) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 5c7266d7a8..2186271491 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -185,7 +185,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, if (strcasecmp_m(s->name, secret_name) != 0) { continue; } - if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, + if (convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, (void **)&secret_string) == -1) { r->out.error_string = talloc_asprintf(mem_ctx, -- cgit From 6c77f353d3d952b46b401ab29837ba5b75e353c2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:13 +0100 Subject: r26328: remove more uses of global_loadparm. (This used to be commit 40ae12c08647c47a9c504d39ee6f61c32b4e5748) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 2186271491..93e25aa428 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, r2.out.error_string = NULL; r2.in.binding_string = r->in.binding_string; - r2.in.rid_crypt = lp_parm_bool(global_loadparm, NULL, "vampire", "rid decrypt", true); + r2.in.rid_crypt = lp_parm_bool(ctx->lp_ctx, NULL, "vampire", "rid decrypt", true); r2.in.init_fn = NULL; r2.in.delta_fn = libnet_samdump_fn; r2.in.fn_ctx = samdump_state; -- cgit From a5b8999f23d56b4a19b87fc17b22c96f88e487e8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 12:19:33 +0100 Subject: r26427: Avoid global_smb_iconv_convenience. (This used to be commit bf072c6fb37b3e6a71c0c747b9fbeaa01480229e) --- source4/libnet/libnet_samdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libnet/libnet_samdump.c') diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 93e25aa428..9d417d280d 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -185,7 +185,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, if (strcasecmp_m(s->name, secret_name) != 0) { continue; } - if (convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, + if (convert_string_talloc(mem_ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, (void **)&secret_string) == -1) { r->out.error_string = talloc_asprintf(mem_ctx, -- cgit