From 34dd8f32e1b7fe256ab5dfde5ef5bb8abeec121a Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Fri, 28 Mar 2008 13:37:25 +0100 Subject: [PATCH] Remove unneeded pack_dsdcinfo/unpack_dsdcinfo. Guenther --- source/libsmb/dsgetdcname.c | 144 -------------------------------------------- 1 file changed, 144 deletions(-) diff --git a/source/libsmb/dsgetdcname.c b/source/libsmb/dsgetdcname.c index d0a08fddb7d..7af43648d78 100644 --- a/source/libsmb/dsgetdcname.c +++ b/source/libsmb/dsgetdcname.c @@ -107,150 +107,6 @@ void debug_dsdcinfo_flags(int lvl, uint32_t flags) DEBUGADD(lvl,("\n")); } -/********************************************************************* - ********************************************************************/ - -static int pack_dsdcinfo(struct netr_DsRGetDCNameInfo *info, - unsigned char **buf) -{ - unsigned char *buffer = NULL; - int len = 0; - int buflen = 0; - UUID_FLAT guid_flat; - - DEBUG(10,("pack_dsdcinfo: Packing dsdcinfo\n")); - - ZERO_STRUCT(guid_flat); - - if (!GUID_all_zero(&info->domain_guid)) { - smb_uuid_pack(info->domain_guid, &guid_flat); - } - - again: - len = 0; - - if (buflen > 0) { - DEBUG(10,("pack_dsdcinfo: Packing domain %s (%s)\n", - info->domain_name, info->dc_unc)); - } - - len += tdb_pack(buffer+len, buflen-len, "ffdBffdff", - info->dc_unc, - info->dc_address, - info->dc_address_type, - UUID_FLAT_SIZE, guid_flat.info, - info->domain_name, - info->forest_name, - info->dc_flags, - info->dc_site_name, - info->client_site_name); - - if (buflen < len) { - SAFE_FREE(buffer); - if ((buffer = SMB_MALLOC_ARRAY(unsigned char, len)) == NULL ) { - DEBUG(0,("pack_dsdcinfo: failed to alloc buffer!\n")); - buflen = -1; - goto done; - } - buflen = len; - goto again; - } - - *buf = buffer; - - done: - return buflen; -} - -/********************************************************************* - ********************************************************************/ - -static NTSTATUS unpack_dsdcinfo(TALLOC_CTX *mem_ctx, - unsigned char *buf, - int buflen, - struct netr_DsRGetDCNameInfo **info_ret) -{ - int len = 0; - struct netr_DsRGetDCNameInfo *info = NULL; - uint32_t guid_len = 0; - unsigned char *guid_buf = NULL; - UUID_FLAT guid_flat; - - /* forgive me 6 times */ - fstring dc_unc; - fstring dc_address; - fstring domain_name; - fstring forest_name; - fstring dc_site_name; - fstring client_site_name; - - info = TALLOC_ZERO_P(mem_ctx, struct netr_DsRGetDCNameInfo); - NT_STATUS_HAVE_NO_MEMORY(info); - - len += tdb_unpack(buf+len, buflen-len, "ffdBffdff", - &dc_unc, - &dc_address, - &info->dc_address_type, - &guid_len, &guid_buf, - &domain_name, - &forest_name, - &info->dc_flags, - &dc_site_name, - &client_site_name); - if (len == -1) { - DEBUG(5,("unpack_dsdcinfo: Failed to unpack domain\n")); - goto failed; - } - - info->dc_unc = - talloc_strdup(mem_ctx, dc_unc); - info->dc_address = - talloc_strdup(mem_ctx, dc_address); - info->domain_name = - talloc_strdup(mem_ctx, domain_name); - info->forest_name = - talloc_strdup(mem_ctx, forest_name); - info->dc_site_name = - talloc_strdup(mem_ctx, dc_site_name); - info->client_site_name = - talloc_strdup(mem_ctx, client_site_name); - - if (!info->dc_unc || - !info->dc_address || - !info->domain_name || - !info->forest_name || - !info->dc_site_name || - !info->client_site_name) { - goto failed; - } - - if (guid_len > 0) { - struct GUID guid; - - if (guid_len != UUID_FLAT_SIZE) { - goto failed; - } - - memcpy(&guid_flat.info, guid_buf, guid_len); - smb_uuid_unpack(guid_flat, &guid); - - info->domain_guid = guid; - SAFE_FREE(guid_buf); - } - - DEBUG(10,("unpack_dcscinfo: Unpacked domain %s (%s)\n", - info->domain_name, info->dc_unc)); - - *info_ret = info; - - return NT_STATUS_OK; - - failed: - TALLOC_FREE(info); - SAFE_FREE(guid_buf); - return NT_STATUS_NO_MEMORY; -} - /**************************************************************** ****************************************************************/ -- 2.11.4.GIT