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,
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 <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "libnet/libnet.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "samba3/samba3.h"
#include "libcli/security/security.h"
+#include "param/param.h"
struct samdump_secret {
{
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);
+ struct samdump_secret *n = talloc(samdump_state, struct samdump_secret);
- 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;
+ n->name = talloc_strdup(n, name);
+ n->secret = data_blob_talloc(n, secret->current_cipher.cipher_data, secret->current_cipher.maxlen);
+ n->mtime = secret->current_cipher_set_time;
- DLIST_ADD(samdump_state->secrets, new);
+ DLIST_ADD(samdump_state->secrets, n);
return NT_STATUS_OK;
}
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);
+ struct samdump_trusted_domain *n = talloc(samdump_state, struct samdump_trusted_domain);
- new->name = talloc_strdup(new, trusted_domain->domain_name.string);
- new->sid = talloc_steal(new, dom_sid);
+ n->name = talloc_strdup(n, trusted_domain->domain_name.string);
+ n->sid = talloc_steal(n, dom_sid);
- DLIST_ADD(samdump_state->trusted_domains, new);
+ DLIST_ADD(samdump_state->trusted_domains, n);
return NT_STATUS_OK;
}
-static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx,
- void *private,
+static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx,
+ void *private_data,
enum netr_SamDatabaseID database,
struct netr_DELTA_ENUM *delta,
char **error_string)
{
NTSTATUS nt_status = NT_STATUS_OK;
- struct samdump_state *samdump_state = private;
+ struct samdump_state *samdump_state = (struct samdump_state *)private_data;
*error_string = NULL;
switch (delta->delta_type) {
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;
if (strcasecmp_m(s->name, secret_name) != 0) {
continue;
}
- if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
+ if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(ctx->lp_ctx), CH_UTF16, CH_UNIX,
s->secret.data, s->secret.length,
- (void **)&secret_string) == -1) {
+ (void **)&secret_string, NULL)) {
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;