summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-11 13:51:09 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-11 13:51:09 +0100
commit08c8d3b992d419db7b39a91fb42208beb5d273ba (patch)
tree141ec98dd654b1431f9c1fa020305a3d1a8905c6 /source4
parent0a6dc219559cb6385b6d2c5482e7588184e9ccc8 (diff)
downloadsamba-08c8d3b992d419db7b39a91fb42208beb5d273ba.tar.gz
samba-08c8d3b992d419db7b39a91fb42208beb5d273ba.tar.bz2
samba-08c8d3b992d419db7b39a91fb42208beb5d273ba.zip
Remove Samba 3 backwards compatibility code in C.
This code is no longer used, and equivalent code already exists in Python (scripting/python/samba/samba3.py) (This used to be commit c16212e8bf5343496ea4b3afc30a8b4d3a0afe2d)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/samba3/config.mk14
-rw-r--r--source4/lib/samba3/group.c141
-rw-r--r--source4/lib/samba3/idmap.c98
-rw-r--r--source4/lib/samba3/policy.c50
-rw-r--r--source4/lib/samba3/registry.c147
-rw-r--r--source4/lib/samba3/samba3.c132
-rw-r--r--source4/lib/samba3/secrets.c263
-rw-r--r--source4/lib/samba3/share_info.c89
-rw-r--r--source4/lib/samba3/tdbsam.c263
-rw-r--r--source4/lib/samba3/winsdb.c160
-rw-r--r--source4/libnet/config.mk2
-rw-r--r--source4/scripting/ejs/config.mk7
-rw-r--r--source4/scripting/ejs/smbcalls_samba3.c501
-rw-r--r--source4/torture/config.mk4
14 files changed, 3 insertions, 1868 deletions
diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk
index 705bdd4002..2d129c5f8c 100644
--- a/source4/lib/samba3/config.mk
+++ b/source4/lib/samba3/config.mk
@@ -1,19 +1,5 @@
################################################
# Start SUBSYSTEM LIBSAMBA3
-[SUBSYSTEM::LIBSAMBA3]
-PRIVATE_PROTO_HEADER = samba3_proto.h
-PUBLIC_HEADERS = samba3.h
-OBJ_FILES = tdbsam.o policy.o \
- idmap.o winsdb.o samba3.o group.o \
- registry.o secrets.o share_info.o
-PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBTDB NDR_SECURITY \
- SMBPASSWD LIBSECURITY
-PUBLIC_DEPENDENCIES = CREDENTIALS
-# End SUBSYSTEM LIBSAMBA3
-################################################
-
-################################################
-# Start SUBSYSTEM LIBSAMBA3
[SUBSYSTEM::SMBPASSWD]
PRIVATE_PROTO_HEADER = samba3_smbpasswd_proto.h
OBJ_FILES = smbpasswd.o
diff --git a/source4/lib/samba3/group.c b/source4/lib/samba3/group.c
deleted file mode 100644
index a0b4c15f0c..0000000000
--- a/source4/lib/samba3/group.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * RPC Pipe client / server routines
- * Copyright (C) Andrew Tridgell 1992-2000,
- * Copyright (C) Jean François Micouleau 1998-2001.
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "lib/samba3/samba3.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "system/filesys.h"
-#include "libcli/security/security.h"
-
-#define DATABASE_VERSION_V1 1 /* native byte format. */
-#define DATABASE_VERSION_V2 2 /* le format. */
-
-#define GROUP_PREFIX "UNIXGROUP/"
-
-/* Alias memberships are stored reverse, as memberships. The performance
- * critical operation is to determine the aliases a SID is member of, not
- * listing alias members. So we store a list of alias SIDs a SID is member of
- * hanging of the member as key.
- */
-#define MEMBEROF_PREFIX "MEMBEROF/"
-
-/****************************************************************************
- Open the group mapping tdb.
-****************************************************************************/
-NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_groupdb *db)
-{
- int32_t vers_id;
- TDB_DATA kbuf, dbuf, newkey;
- int ret;
- TDB_CONTEXT *tdb;
-
- tdb = tdb_open(file, 0, TDB_DEFAULT, O_RDONLY, 0600);
- if (!tdb) {
- DEBUG(0,("Failed to open group mapping database\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- /* Cope with byte-reversed older versions of the db. */
- vers_id = tdb_fetch_int32(tdb, "INFO/version");
- if ((vers_id == DATABASE_VERSION_V1) || (IREV(vers_id) == DATABASE_VERSION_V1)) {
- /* Written on a bigendian machine with old fetch_int code. Save as le. */
- vers_id = DATABASE_VERSION_V2;
- }
-
- if (vers_id != DATABASE_VERSION_V2) {
- DEBUG(0, ("Group database version mismatch: %d\n", vers_id));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- db->groupmappings = NULL;
- db->groupmap_count = 0;
- db->aliases = NULL;
- db->alias_count = 0;
-
- for (kbuf = tdb_firstkey(tdb);
- kbuf.dptr;
- newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf=newkey) {
- struct samba3_groupmapping map;
- const char *k = (const char *)kbuf.dptr;
-
- if (strncmp(k, GROUP_PREFIX, strlen(GROUP_PREFIX)) == 0)
- {
- dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr)
- continue;
-
- ZERO_STRUCT(map);
-
- map.sid = dom_sid_parse_talloc(ctx, k+strlen(GROUP_PREFIX));
-
- ret = tdb_unpack(tdb, (char *)dbuf.dptr, dbuf.dsize, "dd",
- &map.gid, &map.sid_name_use);
-
- if ( ret == -1 ) {
- DEBUG(3,("enum_group_mapping: tdb_unpack failure\n"));
- continue;
- }
-
- map.nt_name = talloc_strdup(ctx, (const char *)(dbuf.dptr+ret));
- map.comment = talloc_strdup(ctx, (const char *)(dbuf.dptr+ret+strlen(map.nt_name)));
-
- db->groupmappings = talloc_realloc(ctx, db->groupmappings, struct samba3_groupmapping, db->groupmap_count+1);
-
- if (!db->groupmappings)
- return NT_STATUS_NO_MEMORY;
-
- db->groupmappings[db->groupmap_count] = map;
-
- db->groupmap_count++;
- } else if (strncmp(k, MEMBEROF_PREFIX, strlen(MEMBEROF_PREFIX)) == 0)
- {
- struct samba3_alias alias;
- const char **member_strlist;
- int i;
-
- dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr)
- continue;
-
- alias.sid = dom_sid_parse_talloc(ctx, k+strlen(MEMBEROF_PREFIX));
- alias.member_count = 0;
- alias.members = NULL;
-
- member_strlist = str_list_make_shell(ctx, (const char *)dbuf.dptr, " ");
-
- for (i = 0; member_strlist[i]; i++) {
- alias.members = talloc_realloc(ctx, alias.members, struct dom_sid *, alias.member_count+1);
- alias.members[alias.member_count] = dom_sid_parse_talloc(ctx, member_strlist[i]);
- alias.member_count++;
- }
-
- talloc_free(member_strlist);
-
- db->aliases = talloc_realloc(ctx, db->aliases, struct samba3_alias, db->alias_count+1);
- db->aliases[db->alias_count] = alias;
- db->alias_count++;
- }
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/idmap.c b/source4/lib/samba3/idmap.c
deleted file mode 100644
index 3eeb2931a8..0000000000
--- a/source4/lib/samba3/idmap.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- idmap TDB backend
-
- Copyright (C) Tim Potter 2000
- Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
- Copyright (C) Simo Sorce 2003
- Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "lib/samba3/samba3.h"
-#include "system/filesys.h"
-#include "libcli/security/security.h"
-
-/* High water mark keys */
-#define HWM_GROUP "GROUP HWM"
-#define HWM_USER "USER HWM"
-
-/* idmap version determines auto-conversion */
-#define IDMAP_VERSION 2
-
-/*****************************************************************************
- Initialise idmap database.
-*****************************************************************************/
-
-NTSTATUS samba3_read_idmap(const char *fn, TALLOC_CTX *ctx, struct samba3_idmapdb *idmap)
-{
- TDB_CONTEXT *tdb;
- TDB_DATA key, val;
- int32_t version;
-
- /* Open idmap repository */
- if (!(tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0644))) {
- DEBUG(0, ("idmap_init: Unable to open idmap database '%s'\n", fn));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- idmap->mapping_count = 0;
- idmap->mappings = NULL;
- idmap->user_hwm = tdb_fetch_int32(tdb, HWM_USER);
- idmap->group_hwm = tdb_fetch_int32(tdb, HWM_GROUP);
-
- /* check against earlier versions */
- version = tdb_fetch_int32(tdb, "IDMAP_VERSION");
- if (version != IDMAP_VERSION) {
- DEBUG(0, ("idmap_init: Unable to open idmap database, it's in an old format!\n"));
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
- for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key))
- {
- struct samba3_idmap_mapping map;
- const char *k = (const char *)key.dptr;
- const char *v;
-
- if (strncmp(k, "GID ", 4) == 0) {
- map.type = IDMAP_GROUP;
- map.unix_id = atoi(k+4);
- val = tdb_fetch(tdb, key);
- v = (const char *)val.dptr;
- map.sid = dom_sid_parse_talloc(ctx, v);
- } else if (strncmp(k, "UID ", 4) == 0) {
- map.type = IDMAP_USER;
- map.unix_id = atoi(k+4);
- val = tdb_fetch(tdb, key);
- v = (const char *)val.dptr;
- map.sid = dom_sid_parse_talloc(ctx, v);
- } else {
- continue;
- }
-
- idmap->mappings = talloc_realloc(ctx, idmap->mappings, struct samba3_idmap_mapping, idmap->mapping_count+1);
-
- idmap->mappings[idmap->mapping_count] = map;
- idmap->mapping_count++;
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/policy.c b/source4/lib/samba3/policy.c
deleted file mode 100644
index 44944770c1..0000000000
--- a/source4/lib/samba3/policy.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * account policy storage
- * Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "lib/samba3/samba3.h"
-#include "system/filesys.h"
-
-NTSTATUS samba3_read_account_policy(const char *fn, TALLOC_CTX *ctx, struct samba3_policy *ret)
-{
- TDB_CONTEXT *tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600);
- if (!tdb) {
- DEBUG(0,("Failed to open account policy database\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- tdb_fetch_uint32(tdb, "min password length", &ret->min_password_length);
- tdb_fetch_uint32(tdb, "password history", &ret->password_history);
- tdb_fetch_uint32(tdb, "user must logon to change pasword", &ret->user_must_logon_to_change_password);
- tdb_fetch_uint32(tdb, "maximum password age", &ret->maximum_password_age);
- tdb_fetch_uint32(tdb, "minimum password age", &ret->minimum_password_age);
- tdb_fetch_uint32(tdb, "lockout duration", &ret->lockout_duration);
- tdb_fetch_uint32(tdb, "reset count minutes", &ret->reset_count_minutes);
- tdb_fetch_uint32(tdb, "bad lockout minutes", &ret->bad_lockout_minutes);
- tdb_fetch_uint32(tdb, "disconnect time", &ret->disconnect_time);
- tdb_fetch_uint32(tdb, "refuse machine password change", &ret->refuse_machine_password_change);
-
- /* FIXME: Read privileges as well */
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/registry.c b/source4/lib/samba3/registry.c
deleted file mode 100644
index 69197883b7..0000000000
--- a/source4/lib/samba3/registry.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Virtual Windows Registry Layer
- * Copyright (C) Gerald Carter 2002-2005
- * Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
- */
-
-/* Implementation of internal registry database functions. */
-
-#include "includes.h"
-#include "lib/samba3/samba3.h"
-#include "librpc/gen_ndr/winreg.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "system/filesys.h"
-#include "pstring.h"
-
-#define VALUE_PREFIX "SAMBA_REGVAL"
-#define REGVER_V1 1 /* first db version with write support */
-
-/****************************************************************************
- Unpack a list of registry values from the TDB
- ***************************************************************************/
-
-static int regdb_unpack_values(TDB_CONTEXT *tdb, TALLOC_CTX *ctx, struct samba3_regkey *key, TDB_DATA data )
-{
- int len = 0;
- uint32_t type;
- uint32_t size;
- uint8_t *data_p;
- uint32_t num_values = 0;
- int i;
- fstring valuename;
-
- /* loop and unpack the rest of the registry values */
-
- len += tdb_unpack(tdb, (char *)data.dptr+len, data.dsize-len, "d", &num_values);
-
- for ( i=0; i<num_values; i++ ) {
- struct samba3_regval val;
- /* unpack the next regval */
-
- type = REG_NONE;
- size = 0;
- data_p = NULL;
- len += tdb_unpack(tdb, (char *)data.dptr+len, data.dsize-len, "fdB",
- valuename,
- &val.type,
- &size,
- &data_p);
- val.name = talloc_strdup(ctx, valuename);
- val.data = data_blob_talloc(ctx, data_p, size);
-
- key->values = talloc_realloc(ctx, key->values, struct samba3_regval, key->value_count+1);
- key->values[key->value_count] = val;
- key->value_count++;
- }
-
- return len;
-}
-
-
-
-/***********************************************************************
- Open the registry database
- ***********************************************************************/
-
-NTSTATUS samba3_read_regdb ( const char *fn, TALLOC_CTX *ctx, struct samba3_regdb *db )
-{
- uint32_t vers_id;
- TDB_CONTEXT *tdb;
- TDB_DATA kbuf, vbuf;
-
- /* placeholder tdb; reinit upon startup */
-
- if ( !(tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600)) )
- {
- DEBUG(0, ("Unable to open registry database %s\n", fn));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- vers_id = tdb_fetch_int32(tdb, "INFO/version");
-
- db->key_count = 0;
- db->keys = NULL;
-
- if (vers_id != -1 && vers_id >= REGVER_V1) {
- DEBUG(0, ("Registry version mismatch: %d\n", vers_id));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- for (kbuf = tdb_firstkey(tdb); kbuf.dptr; kbuf = tdb_nextkey(tdb, kbuf))
- {
- uint32_t len;
- int i;
- struct samba3_regkey key;
- char *skey;
-
- if (strncmp((char *)kbuf.dptr, VALUE_PREFIX, strlen(VALUE_PREFIX)) == 0)
- continue;
-
- vbuf = tdb_fetch(tdb, kbuf);
-
- key.name = talloc_strdup(ctx, (char *)kbuf.dptr);
-
- len = tdb_unpack(tdb, (char *)vbuf.dptr, vbuf.dsize, "d", &key.subkey_count);
-
- key.value_count = 0;
- key.values = NULL;
- key.subkeys = talloc_array(ctx, char *, key.subkey_count);
-
- for (i = 0; i < key.subkey_count; i++) {
- fstring tmp;
- len += tdb_unpack( tdb, (char *)vbuf.dptr+len, vbuf.dsize-len, "f", tmp );
- key.subkeys[i] = talloc_strdup(ctx, tmp);
- }
-
- skey = talloc_asprintf(ctx, "%s/%s", VALUE_PREFIX, kbuf.dptr );
-
- vbuf = tdb_fetch_bystring( tdb, skey );
-
- if ( vbuf.dptr ) {
- regdb_unpack_values( tdb, ctx, &key, vbuf );
- }
-
- db->keys = talloc_realloc(ctx, db->keys, struct samba3_regkey, db->key_count+1);
- db->keys[db->key_count] = key;
- db->key_count++;
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/samba3.c b/source4/lib/samba3/samba3.c
deleted file mode 100644
index 4bd08f188a..0000000000
--- a/source4/lib/samba3/samba3.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "lib/samba3/samba3.h"
-
-struct samba3_domainsecrets *samba3_find_domainsecrets(struct samba3 *db, const char *name)
-{
- int i;
-
- for (i = 0; i < db->secrets.domain_count; i++) {
- if (!strcasecmp_m(db->secrets.domains[i].name, name))
- return &db->secrets.domains[i];
- }
-
- return NULL;
-}
-
-NTSTATUS samba3_read_passdb_backends(TALLOC_CTX *ctx, const char *libdir, struct samba3 *samba3)
-{
- char *dbfile;
- NTSTATUS status = NT_STATUS_OK;
- int i;
- const char **backends = param_get_string_list(samba3->configuration, "passdb backend", NULL, NULL);
-
- /* Default to smbpasswd */
- if (backends == NULL)
- backends = str_list_make(ctx, "smbpasswd", LIST_SEP);
- else
- backends = str_list_copy(ctx, backends);
-
-
- for (i = 0; backends[i]; i++) {
- if (!strncmp(backends[i], "tdbsam", strlen("tdbsam"))) {
- const char *p = strchr(backends[i], ':');
- if (p && p[1]) {
- dbfile = talloc_strdup(ctx, p+1);
- } else {
- dbfile = talloc_asprintf(ctx, "%s/passdb.tdb", libdir);
- }
- samba3_read_tdbsam(dbfile, ctx, &samba3->samaccounts, &samba3->samaccount_count);
- talloc_free(dbfile);
- } else if (!strncmp(backends[i], "smbpasswd", strlen("smbpasswd"))) {
- const char *p = strchr(backends[i], ':');
- if (p && p[1]) {
- dbfile = talloc_strdup(ctx, p+1);
- } else if ((p = param_get_string(samba3->configuration, "smb passwd file", NULL))) {
- dbfile = talloc_strdup(ctx, p);
- } else {
- dbfile = talloc_strdup(ctx, "/etc/samba/smbpasswd");
- }
-
- samba3_read_smbpasswd(dbfile, ctx, &samba3->samaccounts, &samba3->samaccount_count);
- talloc_free(dbfile);
- } else if (!strncmp(backends[i], "ldapsam", strlen("ldapsam"))) {
- /* Will use samba3sam mapping module */
- } else {
- DEBUG(0, ("Upgrade from %s database not supported", backends[i]));
- status = NT_STATUS_NOT_SUPPORTED;
- continue;
- }
- }
-
- talloc_free(backends);
-
- return status;
-}
-
-NTSTATUS samba3_read(const char *libdir, const char *smbconf, TALLOC_CTX *ctx, struct samba3 **samba3)
-{
- struct samba3 *ret;
- char *dbfile = NULL;
-
- ret = talloc_zero(ctx, struct samba3);
-
- if (smbconf != NULL) {
- ret->configuration = param_init(ret);
- if (param_read(ret->configuration, smbconf) == -1) {
- talloc_free(ret);
- return NT_STATUS_UNSUCCESSFUL;
- }
- }
-
- dbfile = talloc_asprintf(ctx, "%s/account_policy.tdb", libdir);
- samba3_read_account_policy(dbfile, ctx, &ret->policy);
- talloc_free(dbfile);
-
- dbfile = talloc_asprintf(ctx, "%s/registry.tdb", libdir);
- samba3_read_regdb(dbfile, ctx, &ret->registry);
- talloc_free(dbfile);
-
- dbfile = talloc_asprintf(ctx, "%s/secrets.tdb", libdir);
- samba3_read_secrets(dbfile, ctx, &ret->secrets);
- talloc_free(dbfile);
-
- dbfile = talloc_asprintf(ctx, "%s/share_info.tdb", libdir);
- samba3_read_share_info(dbfile, ctx, ret);
- talloc_free(dbfile);
-
- dbfile = talloc_asprintf(ctx, "%s/winbindd_idmap.tdb", libdir);
- samba3_read_idmap(dbfile, ctx, &ret->idmap);
- talloc_free(dbfile);
-
- dbfile = talloc_asprintf(ctx, "%s/wins.dat", libdir);
- samba3_read_winsdb(dbfile, ret, &ret->winsdb_entries, &ret->winsdb_count);
- talloc_free(dbfile);
-
- samba3_read_passdb_backends(ctx, libdir, ret);
-
- dbfile = talloc_asprintf(ctx, "%s/group_mapping.tdb", libdir);
- samba3_read_grouptdb(dbfile, ctx, &ret->group);
- talloc_free(dbfile);
-
- *samba3 = ret;
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/secrets.c b/source4/lib/samba3/secrets.c
deleted file mode 100644
index cd1df991a4..0000000000
--- a/source4/lib/samba3/secrets.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Andrew Tridgell 1992-2001
- Copyright (C) Andrew Bartlett 2002
- Copyright (C) Rafal Szczesniak 2002
- Copyright (C) Tim Potter 2001
- Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
-*/
-
-/* the Samba secrets database stores any generated, private information
- such as the local SID and machine trust password */
-
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "lib/samba3/samba3.h"
-#include "system/filesys.h"
-#include "librpc/gen_ndr/security.h"
-#include "auth/credentials/credentials.h"
-
-/**
- * Unpack SID into a pointer
- *
- * @param pack_buf pointer to buffer with packed representation
- * @param bufsize size of the buffer
- * @param sid pointer to sid structure to be filled with unpacked data
- *
- * @return size of structure unpacked from buffer
- **/
-static size_t tdb_sid_unpack(TDB_CONTEXT *tdb, char* pack_buf, int bufsize, struct dom_sid* sid)
-{
- int idx, len = 0;
-
- if (!sid || !pack_buf) return -1;
-
- len += tdb_unpack(tdb, pack_buf + len, bufsize - len, "bb",
- &sid->sid_rev_num, &sid->num_auths);
-
- for (idx = 0; idx < 6; idx++) {
- len += tdb_unpack(tdb, pack_buf + len, bufsize - len, "b", &sid->id_auth[idx]);
- }
-
- for (idx = 0; idx < 15; idx++) {
- len += tdb_unpack(tdb, pack_buf + len, bufsize - len, "d", &sid->sub_auths[idx]);
- }
-
- return len;
-}
-
-static struct samba3_domainsecrets *secrets_find_domain(TALLOC_CTX *ctx, struct samba3_secrets *db, const char *key)
-{
- int i;
-
- for (i = 0; i < db->domain_count; i++)
- {
- if (!strcasecmp_m(db->domains[i].name, key))
- return &db->domains[i];
- }
-
- db->domains = talloc_realloc(ctx, db->domains, struct samba3_domainsecrets, db->domain_count+1);
- ZERO_STRUCT(db->domains[db->domain_count]);
- db->domains[db->domain_count].name = talloc_strdup(db->domains, key);
-
- db->domain_count++;
-
- return &db->domains[db->domain_count-1];
-}
-
-static NTSTATUS ipc_password (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- cli_credentials_set_password(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS ipc_username (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- cli_credentials_set_username(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS ipc_domain (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- cli_credentials_set_domain(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS domain_sid (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
- domainsec->sid.sub_auths = talloc_array(ctx, uint32_t, 15);
- tdb_sid_unpack(tdb, (char *)vbuf.dptr, vbuf.dsize, &domainsec->sid);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS domain_guid (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
- memcpy(&domainsec->guid, vbuf.dptr, vbuf.dsize);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS ldap_bind_pw (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_ldappw pw;
- pw.dn = talloc_strdup(ctx, key);
- pw.password = talloc_strdup(ctx, (const char *)vbuf.dptr);
-
- db->ldappws = talloc_realloc(ctx, db->ldappws, struct samba3_ldappw, db->ldappw_count+1);
- db->ldappws[db->ldappw_count] = pw;
- db->ldappw_count++;
- return NT_STATUS_OK;
-}
-
-static NTSTATUS afs_keyfile (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_afs_keyfile keyfile;
- memcpy(&keyfile, vbuf.dptr, vbuf.dsize);
- keyfile.cell = talloc_strdup(ctx, key);
-
- db->afs_keyfiles = talloc_realloc(ctx, db->afs_keyfiles, struct samba3_afs_keyfile, db->afs_keyfile_count+1);
- db->afs_keyfiles[db->afs_keyfile_count] = keyfile;
- db->afs_keyfile_count++;
-
- return NT_STATUS_OK;
-}
-
-static NTSTATUS machine_sec_channel_type (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
-
- domainsec->sec_channel_type = IVAL(vbuf.dptr, 0);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS machine_last_change_time (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
- domainsec->last_change_time = IVAL(vbuf.dptr, 0);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS machine_password (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
- domainsec->plaintext_pw = talloc_strdup(ctx, (const char *)vbuf.dptr);
- return NT_STATUS_OK;
-}
-
-static NTSTATUS machine_acc (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key);
-
- memcpy(&domainsec->hash_pw, vbuf.dptr, vbuf.dsize);
-
- return NT_STATUS_OK;
-}
-
-static NTSTATUS random_seed (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- /* Ignore */
- return NT_STATUS_OK;
-}
-
-static NTSTATUS domtrust_acc (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- int idx, len = 0;
- struct samba3_trusted_dom_pass pass;
- int pass_len;
-
- if (!vbuf.dptr)
- return NT_STATUS_UNSUCCESSFUL;
-
- /* unpack unicode domain name and plaintext password */
- len += tdb_unpack(tdb, (char *)vbuf.dptr, vbuf.dsize - len, "d", &pass.uni_name_len);
-
- for (idx = 0; idx < 32; idx++)
- len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "w", &pass.uni_name[idx]);
-
- len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "d", &pass_len);
- pass.pass = talloc_strdup(ctx, (char *)(vbuf.dptr+len));
- len += strlen((const char *)vbuf.dptr)+1;
- len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "d", &pass.mod_time);
-
- pass.domain_sid.sub_auths = talloc_array(ctx, uint32_t, 15);
- /* unpack domain sid */
- len += tdb_sid_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, &pass.domain_sid);
-
- /* FIXME: Add to list */
-
- return NT_STATUS_OK;
-}
-
-static const struct {
- const char *prefix;
- NTSTATUS (*handler) (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db);
-} secrets_handlers[] = {
- { "SECRETS/AUTH_PASSWORD", ipc_password },
- { "SECRETS/AUTH_DOMAIN", ipc_domain },
- { "SECRETS/AUTH_USER", ipc_username },
- { "SECRETS/SID/", domain_sid },
- { "SECRETS/DOMGUID/", domain_guid },
- { "SECRETS/LDAP_BIND_PW/", ldap_bind_pw },
- { "SECRETS/AFS_KEYFILE/", afs_keyfile },
- { "SECRETS/MACHINE_SEC_CHANNEL_TYPE/", machine_sec_channel_type },
- { "SECRETS/MACHINE_LAST_CHANGE_TIME/", machine_last_change_time },
- { "SECRETS/MACHINE_PASSWORD/", machine_password },
- { "SECRETS/$MACHINE.ACC/", machine_acc },
- { "SECRETS/$DOMTRUST.ACC/", domtrust_acc },
- { "INFO/random_seed", random_seed },
-};
-
-
-NTSTATUS samba3_read_secrets(const char *fname, TALLOC_CTX *ctx, struct samba3_secrets *db)
-{
- TDB_CONTEXT *tdb = tdb_open(fname, 0, TDB_DEFAULT, O_RDONLY, 0600);
- TDB_DATA kbuf, vbuf;
-
- if (!tdb) {
- DEBUG(0,("Failed to open %s\n", fname));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- ZERO_STRUCTP(db);
-
- db->ipc_cred = cli_credentials_init(ctx);
-
- for (kbuf = tdb_firstkey(tdb); kbuf.dptr; kbuf = tdb_nextkey(tdb, kbuf))
- {
- int i;
- char *key;
- vbuf = tdb_fetch(tdb, kbuf);
-
- for (i = 0; secrets_handlers[i].prefix; i++) {
- if (!strncmp((const char *)kbuf.dptr, secrets_handlers[i].prefix, strlen(secrets_handlers[i].prefix))) {
- key = talloc_strndup(ctx, (const char *)(kbuf.dptr+strlen(secrets_handlers[i].prefix)), kbuf.dsize-strlen(secrets_handlers[i].prefix));
- secrets_handlers[i].handler(tdb, key, vbuf, ctx, db);
- talloc_free(key);
- break;
- }
- }
-
- if (!secrets_handlers[i].prefix) {
- DEBUG(0, ("Unable to find handler for string %s\n", kbuf.dptr));
- }
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/share_info.c b/source4/lib/samba3/share_info.c
deleted file mode 100644
index 4dd15aa918..0000000000
--- a/source4/lib/samba3/share_info.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Share Info parsing
- * Copyright (C) Andrew Tridgell 1992-1997,
- * Copyright (C) Jeremy Allison 2001.
- * Copyright (C) Nigel Williams 2001.
- * Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "librpc/gen_ndr/ndr_security.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "lib/samba3/samba3.h"
-#include "system/filesys.h"
-
-#define SHARE_DATABASE_VERSION_V1 1
-#define SHARE_DATABASE_VERSION_V2 2 /* version id in little endian. */
-
-NTSTATUS samba3_read_share_info(const char *fn, TALLOC_CTX *ctx, struct samba3 *db)
-{
- int32_t vers_id;
- TDB_CONTEXT *tdb;
- TDB_DATA kbuf, vbuf;
- DATA_BLOB blob;
-
- tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600);
- if (!tdb) {
- DEBUG(0,("Failed to open share info database %s (%s)\n",
- fn, strerror(errno) ));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- /* Cope with byte-reversed older versions of the db. */
- vers_id = tdb_fetch_int32(tdb, "INFO/version");
- if ((vers_id == SHARE_DATABASE_VERSION_V1) || (IREV(vers_id) == SHARE_DATABASE_VERSION_V1)) {
- /* Written on a bigendian machine with old fetch_int code. Save as le. */
- vers_id = SHARE_DATABASE_VERSION_V2;
- }
-
- if (vers_id != SHARE_DATABASE_VERSION_V2) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- for (kbuf = tdb_firstkey(tdb); kbuf.dptr; kbuf = tdb_nextkey(tdb, kbuf))
- {
- struct ndr_pull *pull;
- struct samba3_share_info *share;
- char *name;
-
- if (strncmp((char *)kbuf.dptr, "SECDESC/", strlen("SECDESC/")) != 0)
- continue;
-
- name = talloc_strndup(ctx, (char *)kbuf.dptr+strlen("SECDESC/"), kbuf.dsize-strlen("SECDESC/"));
-
- db->shares = talloc_realloc(db, db->shares, struct samba3_share_info, db->share_count+1);
- share = &db->shares[db->share_count];
- db->share_count++;
-
- share->name = talloc_strdup(db, name);
-
- vbuf = tdb_fetch(tdb, kbuf);
- blob.data = (uint8_t *)vbuf.dptr;
- blob.length = vbuf.dsize;
-
- pull = ndr_pull_init_blob(&blob, ctx, lp_iconv_convenience(global_loadparm));
-
- ndr_pull_security_descriptor(pull, NDR_SCALARS|NDR_BUFFERS, &share->secdesc);
-
- talloc_free(pull);
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/tdbsam.c b/source4/lib/samba3/tdbsam.c
deleted file mode 100644
index 8e6b0daf2b..0000000000
--- a/source4/lib/samba3/tdbsam.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- tdb passdb backend format routines
-
- Copyright (C) Simo Sorce 2000-2003
- Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "system/filesys.h"
-#include "lib/tdb/include/tdb.h"
-#include "lib/util/util_tdb.h"
-#include "lib/samba3/samba3.h"
-
-#define TDB_FORMAT_STRING_V0 "ddddddBBBBBBBBBBBBddBBwdwdBwwd"
-#define TDB_FORMAT_STRING_V1 "dddddddBBBBBBBBBBBBddBBwdwdBwwd"
-#define TDB_FORMAT_STRING_V2 "dddddddBBBBBBBBBBBBddBBBwwdBwwd"
-#define TDBSAM_VERSION_STRING "INFO/version"
-
-static bool init_sam_from_buffer_v0(TDB_CONTEXT *tdb, struct samba3_samaccount *sampass, TDB_DATA buf)
-{
- uint32_t username_len, domain_len, nt_username_len,
- dir_drive_len, unknown_str_len, munged_dial_len,
- fullname_len, homedir_len, logon_script_len,
- profile_path_len, acct_desc_len, workstations_len;
-
- uint32_t remove_me;
- uint32_t len = 0;
- uint32_t lm_pw_len, nt_pw_len, hourslen;
-
- if(sampass == NULL || buf.dptr == NULL) {
- DEBUG(0, ("init_sam_from_buffer_v0: NULL parameters found!\n"));
- return false;
- }
-
- /* unpack the buffer into variables */
- len = tdb_unpack (tdb, (char *)buf.dptr, buf.dsize, TDB_FORMAT_STRING_V0,
- &sampass->logon_time, /* d */
- &sampass->logoff_time, /* d */
- &sampass->kickoff_time, /* d */
- &sampass->pass_last_set_time, /* d */
- &sampass->pass_can_change_time, /* d */
- &sampass->pass_must_change_time, /* d */
- &username_len, &sampass->username, /* B */
- &domain_len, &sampass->domain, /* B */
- &nt_username_len, &sampass->nt_username, /* B */
- &fullname_len, &sampass->fullname, /* B */
- &homedir_len, &sampass->homedir, /* B */
- &dir_drive_len, &sampass->dir_drive, /* B */
- &logon_script_len, &sampass->logon_script, /* B */
- &profile_path_len, &sampass->profile_path, /* B */
- &acct_desc_len, &sampass->acct_desc, /* B */
- &workstations_len, &sampass->workstations, /* B */
- &unknown_str_len, &sampass->unknown_str, /* B */
- &munged_dial_len, &sampass->munged_dial, /* B */
- &sampass->user_rid, /* d */
- &sampass->group_rid, /* d */
- &lm_pw_len, sampass->lm_pw.hash, /* B */
- &nt_pw_len, sampass->nt_pw.hash, /* B */
- &sampass->acct_ctrl, /* w */
- &remove_me, /* remove on the next TDB_FORMAT upgarde */ /* d */
- &sampass->logon_divs, /* w */
- &sampass->hours_len, /* d */
- &hourslen, &sampass->hours, /* B */
- &sampass->bad_password_count, /* w */
- &sampass->logon_count, /* w */
- &sampass->unknown_6); /* d */
-
- if (len == (uint32_t) -1) {
- return false;
- }
-
- return true;
-}
-
-static bool init_sam_from_buffer_v1(TDB_CONTEXT *tdb, struct samba3_samaccount *sampass, TDB_DATA buf)
-{
- uint32_t username_len, domain_len, nt_username_len,
- dir_drive_len, unknown_str_len, munged_dial_len,
- fullname_len, homedir_len, logon_script_len,
- profile_path_len, acct_desc_len, workstations_len;
-
- uint32_t remove_me;
- uint32_t len = 0;
- uint32_t lm_pw_len, nt_pw_len, hourslen;
-
- if(sampass == NULL || buf.dptr == NULL) {
- DEBUG(0, ("init_sam_from_buffer_v1: NULL parameters found!\n"));
- return false;
- }
-
- /* unpack the buffer into variables */
- len = tdb_unpack (tdb, (char *)buf.dptr, buf.dsize, TDB_FORMAT_STRING_V1,
- &sampass->logon_time, /* d */
- &sampass->logoff_time, /* d */
- &sampass->kickoff_time, /* d */
- /* Change from V0 is addition of bad_password_time field. */
- &sampass->bad_password_time, /* d */
- &sampass->pass_last_set_time, /* d */
- &sampass->pass_can_change_time, /* d */
- &sampass->pass_must_change_time, /* d */
- &username_len, &sampass->username, /* B */
- &domain_len, &sampass->domain, /* B */
- &nt_username_len, &sampass->nt_username, /* B */
- &fullname_len, &sampass->fullname, /* B */
- &homedir_len, &sampass->homedir, /* B */
- &dir_drive_len, &sampass->dir_drive, /* B */
- &logon_script_len, &sampass->logon_script, /* B */
- &profile_path_len, &sampass->profile_path, /* B */
- &acct_desc_len, &sampass->acct_desc, /* B */
- &workstations_len, &sampass->workstations, /* B */
- &unknown_str_len, &sampass->unknown_str, /* B */
- &munged_dial_len, &sampass->munged_dial, /* B */
- &sampass->user_rid, /* d */
- &sampass->group_rid, /* d */
- &lm_pw_len, sampass->lm_pw.hash, /* B */
- &nt_pw_len, sampass->nt_pw.hash, /* B */
- &sampass->acct_ctrl, /* w */
- &remove_me, /* d */
- &sampass->logon_divs, /* w */
- &sampass->hours_len, /* d */
- &hourslen, &sampass->hours, /* B */
- &sampass->bad_password_count, /* w */
- &sampass->logon_count, /* w */
- &sampass->unknown_6); /* d */
-
- if (len == (uint32_t) -1) {
- return false;
- }
-
- return true;
-}
-
-static bool init_sam_from_buffer_v2(TDB_CONTEXT *tdb, struct samba3_samaccount *sampass, TDB_DATA buf)
-{
- uint32_t username_len, domain_len, nt_username_len,
- dir_drive_len, unknown_str_len, munged_dial_len,
- fullname_len, homedir_len, logon_script_len,
- profile_path_len, acct_desc_len, workstations_len;
-
- uint32_t len = 0;
- uint32_t lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen;
-
- if(sampass == NULL || buf.dptr == NULL) {
- DEBUG(0, ("init_sam_from_buffer_v2: NULL parameters found!\n"));
- return false;
- }
-
- /* unpack the buffer into variables */
- len = tdb_unpack (tdb, (char *)buf.dptr, buf.dsize, TDB_FORMAT_STRING_V2,
- &sampass->logon_time, /* d */
- &sampass->logoff_time, /* d */
- &sampass->kickoff_time, /* d */
- &sampass->bad_password_time, /* d */
- &sampass->pass_last_set_time, /* d */
- &sampass->pass_can_change_time, /* d */
- &sampass->pass_must_change_time, /* d */
- &username_len, &sampass->username, /* B */
- &domain_len, &sampass->domain, /* B */
- &nt_username_len, &sampass->nt_username, /* B */
- &fullname_len, &sampass->fullname, /* B */
- &homedir_len, &sampass->homedir, /* B */
- &dir_drive_len, &sampass->dir_drive, /* B */
- &logon_script_len, &sampass->logon_script, /* B */
- &profile_path_len, &sampass->profile_path, /* B */
- &acct_desc_len, &sampass->acct_desc, /* B */
- &workstations_len, &sampass->workstations, /* B */
- &unknown_str_len, &sampass->unknown_str, /* B */
- &munged_dial_len, &sampass->munged_dial, /* B */
- &sampass->user_rid, /* d */
- &sampass->group_rid, /* d */
- &lm_pw_len, sampass->lm_pw.hash, /* B */
- &nt_pw_len, sampass->nt_pw.hash, /* B */
- /* Change from V1 is addition of password history field. */
- &nt_pw_hist_len, &sampass->nt_pw_hist_ptr, /* B */
- &sampass->acct_ctrl, /* w */
- /* Also "remove_me" field was removed. */
- &sampass->logon_divs, /* w */
- &sampass->hours_len, /* d */
- &hourslen, &sampass->hours, /* B */
- &sampass->bad_password_count, /* w */
- &sampass->logon_count, /* w */
- &sampass->unknown_6); /* d */
-
- if (len == (uint32_t) -1) {
- return false;
- }
-
- return true;
-}
-
-NTSTATUS samba3_read_tdbsam(const char *filename, TALLOC_CTX *ctx, struct samba3_samaccount **accounts, uint32_t *count)
-{
- int32_t version;
- TDB_CONTEXT *tdb;
- TDB_DATA key, val;
-
- /* Try to open tdb passwd */
- if (!(tdb = tdb_open(filename, 0, TDB_DEFAULT, O_RDONLY, 0600))) {
- DEBUG(0, ("Unable to open TDB passwd file '%s'\n", filename));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- /* Check the version */
- version = tdb_fetch_int32(tdb,
- TDBSAM_VERSION_STRING);
- if (version == -1)
- version = 0; /* Version not found, assume version 0 */
-
- /* Compare the version */
- if (version > 2) {
- /* Version more recent than the latest known */
- DEBUG(0, ("TDBSAM version unknown: %d\n", version));
- tdb_close(tdb);
- return NT_STATUS_NOT_SUPPORTED;
- }
-
- *accounts = NULL;
- *count = 0;
-
- for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key))
- {
- bool ret;
- if (strncmp((const char *)key.dptr, "USER_", 5) != 0)
- continue;
-
- val = tdb_fetch(tdb, key);
-
- *accounts = talloc_realloc(ctx, *accounts, struct samba3_samaccount, (*count)+1);
-
- switch (version)
- {
- case 0: ret = init_sam_from_buffer_v0(tdb, &(*accounts)[*count], val); break;
- case 1: ret = init_sam_from_buffer_v1(tdb, &(*accounts)[*count], val); break;
- case 2: ret = init_sam_from_buffer_v2(tdb, &(*accounts)[*count], val); break;
- default: ret = false; break;
-
- }
-
- if (!ret) {
- DEBUG(0, ("Unable to parse SAM account %s\n", key.dptr));
- }
-
- (*count)++;
- }
-
- tdb_close(tdb);
-
- return NT_STATUS_OK;
-}
diff --git a/source4/lib/samba3/winsdb.c b/source4/lib/samba3/winsdb.c
deleted file mode 100644
index 5bed3523ea..0000000000
--- a/source4/lib/samba3/winsdb.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Wins Database
-
- Copyright (C) Jeremy Allison 1994-2003
- Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "includes.h"
-#include "system/filesys.h"
-#include "lib/samba3/samba3.h"
-#include "system/network.h"
-
-#define WINS_VERSION 1
-
-NTSTATUS samba3_read_winsdb( const char *fn, TALLOC_CTX *ctx, struct samba3_winsdb_entry **entries, uint32_t *count )
-{
- XFILE *fp;
- char *line;
-
- if((fp = x_fopen(fn,O_RDONLY,0)) == NULL) {
- DEBUG(0,("initialise_wins: Can't open wins database file %s. Error was %s\n",
- fn, strerror(errno) ));
- return NT_STATUS_OPEN_FAILED;
- }
-
- *count = 0;
- *entries = NULL;
-
- while (!x_feof(fp)) {
- struct samba3_winsdb_entry entry;
- const char *name_str, *ttl_str, *nb_flags_str;
- const char **args;
- char *p;
- int i;
- unsigned int hash;
- int version;
-
- /* Read a line from the wins.dat file. Strips whitespace
- from the beginning and end of the line. */
- line = fgets_slash(NULL,8,fp);
- if (!line) {
- return NT_STATUS_UNEXPECTED_IO_ERROR;
- }
-
- if (*line == '#') {
- SAFE_FREE(line);
- continue;
- }
-
- if (strncmp(line,"VERSION ", 8) == 0) {
- if (sscanf(line,"VERSION %d %u", &version, &hash) != 2 ||
- version != WINS_VERSION) {
- DEBUG(0,("Discarding invalid wins.dat file [%s]\n",line));
- SAFE_FREE(line);
- x_fclose(fp);
- return NT_STATUS_REVISION_MISMATCH;
- }
- SAFE_FREE(line);
-
- continue;
- }
-
- args = str_list_make_shell(ctx, line, NULL);
-
- /*
- * Now we handle multiple IP addresses per name we need
- * to iterate over the line twice. The first time to
- * determine how many IP addresses there are, the second
- * time to actually parse them into the ip_list array.
- */
-
- name_str = args[0];
- if (!name_str) {
- DEBUG(0,("initialise_wins: Failed to parse name when parsing line %s\n", line ));
- SAFE_FREE(line);
- continue;
- }
-
- ttl_str = args[1];
- if (!ttl_str) {
- DEBUG(0,("initialise_wins: Failed to parse time to live when parsing line %s\n", line ));
- SAFE_FREE(line);
- continue;
- }
-
- /*
- * Determine the number of IP addresses per line.
- */
- entry.ip_count = 0;
- for (i = 2; args[i] && strchr(args[i], '.'); i++) entry.ip_count++;
-
- if(entry.ip_count == 0) {
- DEBUG(0,("initialise_wins: Missing IP address when parsing line %s\n", line ));
- SAFE_FREE(line);
- continue;
- }
-
- /* Allocate the space for the ip_list. */
- if((entry.ips = talloc_array ( ctx, struct in_addr, entry.ip_count)) == NULL) {
- DEBUG(0,("initialise_wins: Malloc fail !\n"));
- SAFE_FREE(line);
- return NT_STATUS_NO_MEMORY;
- }
-
- /* Reset and re-parse the line. */
- for(i = 0; i < entry.ip_count; i++) {
- entry.ips[i] = interpret_addr2(args[i+2]);
- }
- nb_flags_str = args[2 + entry.ip_count];
-
- SMB_ASSERT(nb_flags_str);
-
- /*
- * Deal with SELF or REGISTER name encoding. Default is REGISTER
- * for compatibility with old nmbds.
- */
-
- if(nb_flags_str[strlen(nb_flags_str)-1] == 'S') {
- DEBUG(5,("initialise_wins: Ignoring SELF name %s\n", line));
- talloc_free(entry.ips);
- SAFE_FREE(line);
- continue;
- }
-
- /* Netbios name. # divides the name from the type (hex): netbios#xx */
- entry.name = talloc_strdup(ctx, name_str);
-
- if((p = strchr(entry.name,'#')) != NULL) {
- *p = 0;
- sscanf(p+1,"%x",&entry.type);
- }
-
- /* Decode the netbios flags (hex) and the time-to-live (in seconds). */
- sscanf(nb_flags_str,"%x",&entry.nb_flags);
- entry.ttl = atol(ttl_str);
-
- *entries = talloc_realloc(ctx, *entries, struct samba3_winsdb_entry, (*count)+1);
- (*entries)[*count] = entry;
-
- (*count)++;
- }
-
- x_fclose(fp);
- return NT_STATUS_OK;
-}
diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk
index 9041ff5a23..a72ae5b51f 100644
--- a/source4/libnet/config.mk
+++ b/source4/libnet/config.mk
@@ -27,7 +27,7 @@ OBJ_FILES = \
userman.o \
groupman.o \
prereq_domain.o
-PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBSAMBA3 LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR
+PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR SMBPASSWD
[PYTHON::swig_net]
PRIVATE_DEPENDENCIES = LIBSAMBA-NET
diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk
index 656ecdae16..5de17263b7 100644
--- a/source4/scripting/ejs/config.mk
+++ b/source4/scripting/ejs/config.mk
@@ -28,13 +28,6 @@ SUBSYSTEM = smbcalls
OUTPUT_TYPE = INTEGRATED
INIT_FUNCTION = smb_setup_ejs_nbt
-[MODULE::smbcalls_samba3]
-OBJ_FILES = smbcalls_samba3.o
-SUBSYSTEM = smbcalls
-OUTPUT_TYPE = INTEGRATED
-INIT_FUNCTION = smb_setup_ejs_samba3
-PRIVATE_DEPENDENCIES = LIBSAMBA3
-
[MODULE::smbcalls_rand]
OBJ_FILES = smbcalls_rand.o
SUBSYSTEM = smbcalls
diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c
deleted file mode 100644
index 36ec2a54e4..0000000000
--- a/source4/scripting/ejs/smbcalls_samba3.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- provide hooks into smbd C calls from ejs scripts
-
- Copyright (C) Jelmer Vernooij 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "scripting/ejs/smbcalls.h"
-#include "lib/appweb/ejs/ejs.h"
-#include "lib/samba3/samba3.h"
-#include "libcli/security/security.h"
-#include "librpc/gen_ndr/ndr_misc.h"
-#include "system/network.h"
-
-
-static struct MprVar mprRegistry(struct samba3_regdb *reg)
-{
- struct MprVar mpv = mprObject("registry"), ks, vs, k, v;
- int i, j;
-
- ks = mprArray("array");
-
- for (i = 0; i < reg->key_count; i++) {
- k = mprObject("regkey");
-
- mprSetVar(&k, "name", mprString(reg->keys[i].name));
-
- vs = mprArray("array");
-
- for (j = 0; j < reg->keys[i].value_count; j++) {
- v = mprObject("regval");
-
- mprSetVar(&v, "name", mprString(reg->keys[i].values[j].name));
- mprSetVar(&v, "type", mprCreateIntegerVar(reg->keys[i].values[j].type));
- mprSetVar(&v, "data", mprDataBlob(reg->keys[i].values[j].data));
-
- mprAddArray(&vs, j, v);
- }
-
- mprSetVar(&k, "values", vs);
-
- mprAddArray(&ks, i, k);
- }
-
- if (i == 0) {
- mprSetVar(&ks, "length", mprCreateIntegerVar(i));
- }
-
- mprSetVar(&mpv, "keys", ks);
-
- return mpv;
-}
-
-static struct MprVar mprPolicy(struct samba3_policy *pol)
-{
- struct MprVar mpv = mprObject("policy");
-
- mprSetVar(&mpv, "min_password_length", mprCreateIntegerVar(pol->min_password_length));
- mprSetVar(&mpv, "password_history", mprCreateIntegerVar(pol->password_history));
- mprSetVar(&mpv, "user_must_logon_to_change_password", mprCreateIntegerVar(pol->user_must_logon_to_change_password));
- mprSetVar(&mpv, "maximum_password_age", mprCreateIntegerVar(pol->maximum_password_age));
- mprSetVar(&mpv, "minimum_password_age", mprCreateIntegerVar(pol->minimum_password_age));
- mprSetVar(&mpv, "lockout_duration", mprCreateIntegerVar(pol->lockout_duration));
- mprSetVar(&mpv, "reset_count_minutes", mprCreateIntegerVar(pol->reset_count_minutes));
- mprSetVar(&mpv, "bad_lockout_minutes", mprCreateIntegerVar(pol->bad_lockout_minutes));
- mprSetVar(&mpv, "disconnect_time", mprCreateIntegerVar(pol->disconnect_time));
- mprSetVar(&mpv, "refuse_machine_password_change", mprCreateIntegerVar(pol->refuse_machine_password_change));
-
- return mpv;
-}
-
-static struct MprVar mprIdmapDb(struct samba3_idmapdb *db)
-{
- struct MprVar mpv = mprObject("idmapdb"), mps, mp;
- int i;
-
- mprSetVar(&mpv, "user_hwm", mprCreateIntegerVar(db->user_hwm));
- mprSetVar(&mpv, "group_hwm", mprCreateIntegerVar(db->group_hwm));
-
- mps = mprArray("array");
-
- for (i = 0; i < db->mapping_count; i++) {
- char *tmp;
- mp = mprObject("idmap");
-
- mprSetVar(&mp, "IDMAP_GROUP", mprCreateIntegerVar(IDMAP_GROUP));
- mprSetVar(&mp, "IDMAP_USER", mprCreateIntegerVar(IDMAP_USER));
- mprSetVar(&mp, "type", mprCreateIntegerVar(db->mappings[i].type));
- mprSetVar(&mp, "unix_id", mprCreateIntegerVar(db->mappings[i].unix_id));
-
- tmp = dom_sid_string(NULL, db->mappings[i].sid);
- mprSetVar(&mp, "sid", mprString(tmp));
- talloc_free(tmp);
-
- mprAddArray(&mps, i, mp);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
-
- mprSetVar(&mpv, "mappings", mps);
-
- return mpv;
-}
-
-static struct MprVar mprGroupMappings(struct samba3_groupdb *db)
-{
- struct MprVar mpv = mprArray("array"), g;
- int i;
-
- for (i = 0; i < db->groupmap_count; i++) {
- char *tmp;
- g = mprObject("group");
-
- mprSetVar(&g, "gid", mprCreateIntegerVar(db->groupmappings[i].gid));
-
- tmp = dom_sid_string(NULL, db->groupmappings[i].sid);
- mprSetVar(&g, "sid", mprString(tmp));
- talloc_free(tmp);
-
- mprSetVar(&g, "sid_name_use", mprCreateIntegerVar(db->groupmappings[i].sid_name_use));
- mprSetVar(&g, "nt_name", mprString(db->groupmappings[i].nt_name));
- mprSetVar(&g, "comment", mprString(db->groupmappings[i].comment));
-
- mprAddArray(&mpv, i, g);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
-
- return mpv;
-}
-
-static struct MprVar mprAliases(struct samba3_groupdb *db)
-{
- struct MprVar mpv = mprObject("array"), a, am;
- int i, j;
-
- for (i = 0; i < db->alias_count; i++) {
- char *tmp;
- a = mprObject("alias");
-
- tmp = dom_sid_string(NULL, db->aliases[i].sid);
- mprSetVar(&a, "sid", mprString(tmp));
- talloc_free(tmp);
-
- am = mprArray("array");
-
- for (j = 0; j < db->aliases[i].member_count; j++) {
- tmp = dom_sid_string(NULL, db->aliases[i].members[j]);
- mprAddArray(&am, j, mprString(tmp));
- talloc_free(tmp);
- }
-
- mprSetVar(&a, "members", am);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
- return mpv;
-}
-
-static struct MprVar mprDomainSecrets(struct samba3_domainsecrets *ds)
-{
- struct MprVar v, e = mprObject("domainsecrets");
- char *tmp;
- DATA_BLOB blob;
-
- mprSetVar(&e, "name", mprString(ds->name));
-
- tmp = dom_sid_string(NULL, &ds->sid);
- mprSetVar(&e, "sid", mprString(tmp));
- talloc_free(tmp);
-
- tmp = GUID_string(NULL, &ds->guid);
- mprSetVar(&e, "guid", mprString(tmp));
- talloc_free(tmp);
-
- mprSetVar(&e, "plaintext_pw", mprString(ds->plaintext_pw));
-
- mprSetVar(&e, "last_change_time", mprCreateIntegerVar(ds->last_change_time));
- mprSetVar(&e, "sec_channel_type", mprCreateIntegerVar(ds->sec_channel_type));
-
- v = mprObject("hash_pw");
-
- blob.data = ds->hash_pw.hash;
- blob.length = 16;
- mprSetVar(&v, "hash", mprDataBlob(blob));
-
- mprSetVar(&v, "mod_time", mprCreateIntegerVar(ds->hash_pw.mod_time));
-
- mprSetVar(&e, "hash_pw", v);
-
- return e;
-}
-
-static struct MprVar mprSecrets(struct samba3_secrets *sec)
-{
- struct MprVar mpv = mprObject("samba3_secrets"), es, e;
- int i;
-
- es = mprArray("array");
-
- for (i = 0; i < sec->ldappw_count; i++) {
- e = mprObject("ldappw");
-
- mprSetVar(&e, "dn", mprString(sec->ldappws[i].dn));
- mprSetVar(&e, "password", mprString(sec->ldappws[i].password));
-
- mprAddArray(&es, i, e);
- }
-
- mprSetVar(&mpv, "ldappws", es);
-
- es = mprArray("array");
-
- for (i = 0; i < sec->domain_count; i++) {
- mprAddArray(&es, i, mprDomainSecrets(&sec->domains[i]));
- }
-
- if (i == 0) {
- mprSetVar(&es, "length", mprCreateIntegerVar(i));
- }
-
- mprSetVar(&mpv, "domains", es);
-
- es = mprArray("trusted_domains");
-
- for (i = 0; i < sec->trusted_domain_count; i++) {
- struct MprVar ns;
- char *tmp;
- int j;
- e = mprObject("trusted_domain");
-
- ns = mprArray("array");
-
- for (j = 0; j < sec->trusted_domains[i].uni_name_len; j++) {
- mprAddArray(&ns, j, mprString(sec->trusted_domains[i].uni_name[j]));
- }
-
- mprSetVar(&e, "uni_name", ns);
-
- mprSetVar(&e, "pass", mprString(sec->trusted_domains[i].pass));
- mprSetVar(&e, "mod_time", mprCreateIntegerVar(sec->trusted_domains[i].mod_time));
-
- tmp = dom_sid_string(NULL, &sec->trusted_domains[i].domain_sid);
- mprSetVar(&e, "domains_sid", mprString(tmp));
- talloc_free(tmp);
-
- mprAddArray(&es, i, e);
- }
-
- if (i == 0) {
- mprSetVar(&es, "length", mprCreateIntegerVar(i));
- }
-
- mprSetVar(&mpv, "trusted_domains", es);
-
- es = mprArray("array");
-
- for (i = 0; i < sec->afs_keyfile_count; i++) {
- struct MprVar ks;
- int j;
- e = mprObject("afs_keyfile");
-
- mprSetVar(&e, "cell", mprString(sec->afs_keyfiles[i].cell));
-
- ks = mprArray("array");
-
- for (j = 0; j < 8; j++) {
- struct MprVar k = mprObject("entry");
- DATA_BLOB blob;
-
- mprSetVar(&k, "kvno", mprCreateIntegerVar(sec->afs_keyfiles[i].entry[j].kvno));
- blob.data = (uint8_t*)sec->afs_keyfiles[i].entry[j].key;
- blob.length = 8;
- mprSetVar(&k, "key", mprDataBlob(blob));
-
- mprAddArray(&ks, j, k);
- }
-
- mprSetVar(&e, "entry", ks);
-
- mprSetVar(&e, "nkeys", mprCreateIntegerVar(sec->afs_keyfiles[i].nkeys));
-
- mprAddArray(&es, i, e);
- }
-
- if (i == 0) {
- mprSetVar(&es, "length", mprCreateIntegerVar(i));
- }
-
- mprSetVar(&mpv, "afs_keyfiles", es);
-
- mprSetVar(&mpv, "ipc_cred", mprCredentials(sec->ipc_cred));
-
- return mpv;
-}
-
-static struct MprVar mprShares(struct samba3 *samba3)
-{
- struct MprVar mpv = mprArray("array"), s;
- int i;
-
- for (i = 0; i < samba3->share_count; i++) {
- s = mprObject("share");
-
- mprSetVar(&s, "name", mprString(samba3->shares[i].name));
-
- /* FIXME: secdesc */
-
- mprAddArray(&mpv, i, s);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
- return mpv;
-}
-
-static struct MprVar mprSamAccounts(struct samba3 *samba3)
-{
- struct MprVar mpv = mprArray("array"), m;
- int i;
-
- for (i = 0; i < samba3->samaccount_count; i++) {
- struct samba3_samaccount *a = &samba3->samaccounts[i];
- DATA_BLOB blob;
-
- m = mprObject("samba3_samaccount");
-
- mprSetVar(&m, "logon_time", mprCreateIntegerVar(a->logon_time));
- mprSetVar(&m, "logoff_time", mprCreateIntegerVar(a->logoff_time));
- mprSetVar(&m, "kickoff_time", mprCreateIntegerVar(a->kickoff_time));
- mprSetVar(&m, "bad_password_time", mprCreateIntegerVar(a->bad_password_time));
- mprSetVar(&m, "pass_last_set_time", mprCreateIntegerVar(a->pass_last_set_time));
- mprSetVar(&m, "pass_can_change_time", mprCreateIntegerVar(a->pass_can_change_time));
- mprSetVar(&m, "pass_must_change_time", mprCreateIntegerVar(a->pass_must_change_time));
- mprSetVar(&m, "user_rid", mprCreateIntegerVar(a->user_rid));
- mprSetVar(&m, "group_rid", mprCreateIntegerVar(a->group_rid));
- mprSetVar(&m, "acct_ctrl", mprCreateIntegerVar(a->acct_ctrl));
- mprSetVar(&m, "logon_divs", mprCreateIntegerVar(a->logon_divs));
- mprSetVar(&m, "bad_password_count", mprCreateIntegerVar(a->bad_password_count));
- mprSetVar(&m, "logon_count", mprCreateIntegerVar(a->logon_count));
- mprSetVar(&m, "username", mprString(a->username));
- mprSetVar(&m, "domain", mprString(a->domain));
- mprSetVar(&m, "nt_username", mprString(a->nt_username));
- mprSetVar(&m, "dir_drive", mprString(a->dir_drive));
- mprSetVar(&m, "munged_dial", mprString(a->munged_dial));
- mprSetVar(&m, "fullname", mprString(a->fullname));
- mprSetVar(&m, "homedir", mprString(a->homedir));
- mprSetVar(&m, "logon_script", mprString(a->logon_script));
- mprSetVar(&m, "profile_path", mprString(a->profile_path));
- mprSetVar(&m, "acct_desc", mprString(a->acct_desc));
- mprSetVar(&m, "workstations", mprString(a->workstations));
- blob.length = 16;
- blob.data = a->lm_pw.hash;
- mprSetVar(&m, "lm_pw", mprDataBlob(blob));
- blob.data = a->nt_pw.hash;
- mprSetVar(&m, "nt_pw", mprDataBlob(blob));
-
- mprAddArray(&mpv, i, m);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
- return mpv;
-}
-
-static struct MprVar mprWinsEntries(struct samba3 *samba3)
-{
- struct MprVar mpv = mprArray("array");
- int i, j;
-
- for (i = 0; i < samba3->winsdb_count; i++) {
- struct MprVar w = mprObject("wins_entry"), ips;
-
- mprSetVar(&w, "name", mprString(samba3->winsdb_entries[i].name));
- mprSetVar(&w, "nb_flags", mprCreateIntegerVar(samba3->winsdb_entries[i].nb_flags));
- mprSetVar(&w, "type", mprCreateIntegerVar(samba3->winsdb_entries[i].type));
- mprSetVar(&w, "ttl", mprCreateIntegerVar(samba3->winsdb_entries[i].ttl));
-
- ips = mprObject("array");
-
- for (j = 0; j < samba3->winsdb_entries[i].ip_count; j++) {
- const char *addr;
- addr = inet_ntoa(samba3->winsdb_entries[i].ips[j]);
- mprAddArray(&ips, j, mprString(addr));
- }
-
- mprSetVar(&w, "ips", ips);
-
- mprAddArray(&mpv, i, w);
- }
-
- if (i == 0) {
- mprSetVar(&mpv, "length", mprCreateIntegerVar(i));
- }
-
- return mpv;
-}
-
-static int ejs_find_domainsecrets(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct samba3 *samba3 = NULL;
- struct samba3_domainsecrets *sec;
-
- if (argc < 1) {
- ejsSetErrorMsg(eid, "find_domainsecrets invalid arguments");
- return -1;
- }
-
- samba3 = (struct samba3 *)mprGetThisPtr(eid, "samba3");
- mprAssert(samba3);
- sec = samba3_find_domainsecrets(samba3, mprToString(argv[0]));
-
- if (sec == NULL) {
- mpr_Return(eid, mprCreateUndefinedVar());
- } else {
- mpr_Return(eid, mprDomainSecrets(sec));
- }
-
- return 0;
-}
-
-/*
- initialise samba3 ejs subsystem
-
- samba3 = samba3_read(libdir,smbconf)
-*/
-static int ejs_samba3_read(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct MprVar mpv = mprObject("samba3");
- struct samba3 *samba3;
- NTSTATUS status;
-
- if (argc < 2) {
- ejsSetErrorMsg(eid, "samba3_read invalid arguments");
- return -1;
- }
-
- status = samba3_read(mprToString(argv[0]), mprToString(argv[1]), mprMemCtx(), &samba3);
-
- if (NT_STATUS_IS_ERR(status)) {
- ejsSetErrorMsg(eid, "samba3_read: error");
- return -1;
- }
-
- mprAssert(samba3);
-
- mprSetPtrChild(&mpv, "samba3", samba3);
- mprSetVar(&mpv, "winsentries", mprWinsEntries(samba3));
- mprSetVar(&mpv, "samaccounts", mprSamAccounts(samba3));
- mprSetVar(&mpv, "shares", mprShares(samba3));
- mprSetVar(&mpv, "secrets", mprSecrets(&samba3->secrets));
- mprSetVar(&mpv, "groupmappings", mprGroupMappings(&samba3->group));
- mprSetVar(&mpv, "aliases", mprAliases(&samba3->group));
- mprSetVar(&mpv, "idmapdb", mprIdmapDb(&samba3->idmap));
- mprSetVar(&mpv, "policy", mprPolicy(&samba3->policy));
- mprSetVar(&mpv, "registry", mprRegistry(&samba3->registry));
- mprSetVar(&mpv, "configuration", mprParam(samba3->configuration));
- mprSetCFunction(&mpv, "find_domainsecrets", ejs_find_domainsecrets);
-
- mpr_Return(eid, mpv);
-
- return 0;
-}
-
-
-/*
- setup C functions that be called from ejs
-*/
-NTSTATUS smb_setup_ejs_samba3(void)
-{
- ejsDefineCFunction(-1, "samba3_read", ejs_samba3_read, NULL, MPR_VAR_SCRIPT_HANDLE);
- return NT_STATUS_OK;
-}
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index e9ef18ac07..0c5e641b4b 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -196,8 +196,8 @@ OBJ_FILES = \
auth/ntlmssp.o \
auth/pac.o
PRIVATE_DEPENDENCIES = \
- LIBCLI_SMB gensec auth LIBSAMBA3 KERBEROS \
- POPT_CREDENTIALS
+ LIBCLI_SMB gensec auth KERBEROS \
+ POPT_CREDENTIALS SMBPASSWD
# End SUBSYSTEM TORTURE_AUTH
#################################