The branch, v4-0-test has been updated via c16212e8bf5343496ea4b3afc30a8b4d3a0afe2d (commit) via 7aff2ddd8ca1ff68fc704fdb139d81d6daa51115 (commit) from eb04de69c0e319e18b148191946808f81e1cc8c4 (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v4-0-test - Log ----------------------------------------------------------------- commit c16212e8bf5343496ea4b3afc30a8b4d3a0afe2d Author: Jelmer Vernooij <[EMAIL PROTECTED]> Date: Mon Feb 11 13:51:09 2008 +0100 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) commit 7aff2ddd8ca1ff68fc704fdb139d81d6daa51115 Author: Jelmer Vernooij <[EMAIL PROTECTED]> Date: Mon Feb 11 13:38:07 2008 +0100 Remove tests for Samba 3 EJS code. ----------------------------------------------------------------------- Summary of changes: source/lib/samba3/config.mk | 14 - source/lib/samba3/group.c | 141 ---- source/lib/samba3/idmap.c | 98 --- source/lib/samba3/policy.c | 50 -- source/lib/samba3/registry.c | 147 ---- source/lib/samba3/samba3.c | 132 ---- source/lib/samba3/secrets.c | 263 ------- source/lib/samba3/share_info.c | 89 --- source/lib/samba3/tdbsam.c | 263 ------- source/lib/samba3/winsdb.c | 160 ---- source/libnet/config.mk | 2 +- source/scripting/ejs/config.mk | 7 - source/scripting/ejs/smbcalls_samba3.c | 501 ------------- source/selftest/samba4_tests.sh | 5 +- source/torture/config.mk | 4 +- testdata/samba3/verify | 59 -- testprogs/ejs/samba3sam.js | 1255 -------------------------------- 17 files changed, 4 insertions(+), 3186 deletions(-) delete mode 100644 source/lib/samba3/group.c delete mode 100644 source/lib/samba3/idmap.c delete mode 100644 source/lib/samba3/policy.c delete mode 100644 source/lib/samba3/registry.c delete mode 100644 source/lib/samba3/samba3.c delete mode 100644 source/lib/samba3/secrets.c delete mode 100644 source/lib/samba3/share_info.c delete mode 100644 source/lib/samba3/tdbsam.c delete mode 100644 source/lib/samba3/winsdb.c delete mode 100644 source/scripting/ejs/smbcalls_samba3.c delete mode 100755 testdata/samba3/verify delete mode 100755 testprogs/ejs/samba3sam.js Changeset truncated at 500 lines: diff --git a/source/lib/samba3/config.mk b/source/lib/samba3/config.mk index 705bdd4..2d129c5 100644 --- a/source/lib/samba3/config.mk +++ b/source/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/source/lib/samba3/group.c b/source/lib/samba3/group.c deleted file mode 100644 index a0b4c15..0000000 --- a/source/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/source/lib/samba3/idmap.c b/source/lib/samba3/idmap.c deleted file mode 100644 index 3eeb293..0000000 --- a/source/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 <[EMAIL PROTECTED]> 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/source/lib/samba3/policy.c b/source/lib/samba3/policy.c deleted file mode 100644 index 4494477..0000000 --- a/source/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/source/lib/samba3/registry.c b/source/lib/samba3/registry.c deleted file mode 100644 index 6919788..0000000 --- a/source/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/source/lib/samba3/samba3.c b/source/lib/samba3/samba3.c deleted file mode 100644 index 4bd08f1..0000000 --- a/source/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, -- Samba Shared Repository