From 08c8d3b992d419db7b39a91fb42208beb5d273ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Feb 2008 13:51:09 +0100 Subject: 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) --- source4/lib/samba3/share_info.c | 89 ----------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 source4/lib/samba3/share_info.c (limited to 'source4/lib/samba3/share_info.c') 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 . - */ - -#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; -} -- cgit