From 09731c76877137291f0041711f01b40e33eb3d1c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 1 Oct 2011 09:15:58 +0200 Subject: s3:msdfs: removed unused variables metze --- source3/smbd/msdfs.c | 209 --------------------------------------------------- 1 file changed, 209 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 89e1125e05..de700423ae 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -1003,215 +1003,6 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, return status; } -static int setup_ver2_dfs_referral(const char *pathname, - char **ppdata, - struct junction_map *junction, - bool self_referral) -{ - char* pdata = *ppdata; - - smb_ucs2_t *uni_requestedpath = NULL; - int uni_reqpathoffset1,uni_reqpathoffset2; - int uni_curroffset; - int requestedpathlen=0; - int offset; - int reply_size = 0; - int i=0; - - DEBUG(10,("Setting up version2 referral\nRequested path:\n")); - - requestedpathlen = rpcstr_push_talloc(talloc_tos(), - &uni_requestedpath, pathname); - if (uni_requestedpath == NULL || requestedpathlen == 0) { - return -1; - } - - if (DEBUGLVL(10)) { - dump_data(0, (unsigned char *)uni_requestedpath, - requestedpathlen); - } - - DEBUG(10,("ref count = %u\n",junction->referral_count)); - - uni_reqpathoffset1 = REFERRAL_HEADER_SIZE + - VERSION2_REFERRAL_SIZE * junction->referral_count; - - uni_reqpathoffset2 = uni_reqpathoffset1 + requestedpathlen; - - uni_curroffset = uni_reqpathoffset2 + requestedpathlen; - - reply_size = REFERRAL_HEADER_SIZE + - VERSION2_REFERRAL_SIZE*junction->referral_count + - 2 * requestedpathlen; - DEBUG(10,("reply_size: %u\n",reply_size)); - - /* add up the unicode lengths of all the referral paths */ - for(i=0;ireferral_count;i++) { - DEBUG(10,("referral %u : %s\n", - i, - junction->referral_list[i].alternate_path)); - reply_size += - (strlen(junction->referral_list[i].alternate_path)+1)*2; - } - - DEBUG(10,("reply_size = %u\n",reply_size)); - /* add the unexplained 0x16 bytes */ - reply_size += 0x16; - - pdata = (char *)SMB_REALLOC(pdata,reply_size); - if(pdata == NULL) { - DEBUG(0,("Realloc failed!\n")); - return -1; - } - *ppdata = pdata; - - /* copy in the dfs requested paths.. required for offset calculations */ - memcpy(pdata+uni_reqpathoffset1,uni_requestedpath,requestedpathlen); - memcpy(pdata+uni_reqpathoffset2,uni_requestedpath,requestedpathlen); - - /* create the header */ - SSVAL(pdata,0,requestedpathlen - 2); /* UCS2 of path consumed minus - 2 byte null */ - /* number of referral in this pkt */ - SSVAL(pdata,2,junction->referral_count); - if(self_referral) { - SIVAL(pdata,4,DFSREF_REFERRAL_SERVER | DFSREF_STORAGE_SERVER); - } else { - SIVAL(pdata,4,DFSREF_STORAGE_SERVER); - } - - offset = 8; - /* add the referral elements */ - for(i=0;ireferral_count;i++) { - struct referral* ref = &junction->referral_list[i]; - int unilen; - - SSVAL(pdata,offset,2); /* version 2 */ - SSVAL(pdata,offset+2,VERSION2_REFERRAL_SIZE); - if(self_referral) { - SSVAL(pdata,offset+4,1); - } else { - SSVAL(pdata,offset+4,0); - } - - /* ref_flags :use path_consumed bytes? */ - SSVAL(pdata,offset+6,0); - SIVAL(pdata,offset+8,ref->proximity); - SIVAL(pdata,offset+12,ref->ttl); - - SSVAL(pdata,offset+16,uni_reqpathoffset1-offset); - SSVAL(pdata,offset+18,uni_reqpathoffset2-offset); - /* copy referred path into current offset */ - unilen = rpcstr_push(pdata+uni_curroffset, - ref->alternate_path, - reply_size - uni_curroffset, - STR_UNICODE); - - SSVAL(pdata,offset+20,uni_curroffset-offset); - - uni_curroffset += unilen; - offset += VERSION2_REFERRAL_SIZE; - } - /* add in the unexplained 22 (0x16) bytes at the end */ - memset(pdata+uni_curroffset,'\0',0x16); - return reply_size; -} - -static int setup_ver3_dfs_referral(const char *pathname, - char **ppdata, - struct junction_map *junction, - bool self_referral) -{ - char *pdata = *ppdata; - - smb_ucs2_t *uni_reqpath = NULL; - int uni_reqpathoffset1, uni_reqpathoffset2; - int uni_curroffset; - int reply_size = 0; - - int reqpathlen = 0; - int offset,i=0; - - DEBUG(10,("setting up version3 referral\n")); - - reqpathlen = rpcstr_push_talloc(talloc_tos(), &uni_reqpath, pathname); - if (uni_reqpath == NULL || reqpathlen == 0) { - return -1; - } - - if (DEBUGLVL(10)) { - dump_data(0, (unsigned char *)uni_reqpath, - reqpathlen); - } - - uni_reqpathoffset1 = REFERRAL_HEADER_SIZE + - VERSION3_REFERRAL_SIZE * junction->referral_count; - uni_reqpathoffset2 = uni_reqpathoffset1 + reqpathlen; - reply_size = uni_curroffset = uni_reqpathoffset2 + reqpathlen; - - for(i=0;ireferral_count;i++) { - DEBUG(10,("referral %u : %s\n", - i, - junction->referral_list[i].alternate_path)); - reply_size += - (strlen(junction->referral_list[i].alternate_path)+1)*2; - } - - pdata = (char *)SMB_REALLOC(pdata,reply_size); - if(pdata == NULL) { - DEBUG(0,("version3 referral setup:" - "malloc failed for Realloc!\n")); - return -1; - } - *ppdata = pdata; - - /* create the header */ - SSVAL(pdata,0,reqpathlen - 2); /* UCS2 of path consumed minus - 2 byte null */ - SSVAL(pdata,2,junction->referral_count); /* number of referral */ - if(self_referral) { - SIVAL(pdata,4,DFSREF_REFERRAL_SERVER | DFSREF_STORAGE_SERVER); - } else { - SIVAL(pdata,4,DFSREF_STORAGE_SERVER); - } - - /* copy in the reqpaths */ - memcpy(pdata+uni_reqpathoffset1,uni_reqpath,reqpathlen); - memcpy(pdata+uni_reqpathoffset2,uni_reqpath,reqpathlen); - - offset = 8; - for(i=0;ireferral_count;i++) { - struct referral* ref = &(junction->referral_list[i]); - int unilen; - - SSVAL(pdata,offset,3); /* version 3 */ - SSVAL(pdata,offset+2,VERSION3_REFERRAL_SIZE); - if(self_referral) { - SSVAL(pdata,offset+4,1); - } else { - SSVAL(pdata,offset+4,0); - } - - /* ref_flags :use path_consumed bytes? */ - SSVAL(pdata,offset+6,0); - SIVAL(pdata,offset+8,ref->ttl); - - SSVAL(pdata,offset+12,uni_reqpathoffset1-offset); - SSVAL(pdata,offset+14,uni_reqpathoffset2-offset); - /* copy referred path into current offset */ - unilen = rpcstr_push(pdata+uni_curroffset,ref->alternate_path, - reply_size - uni_curroffset, - STR_UNICODE | STR_TERMINATE); - SSVAL(pdata,offset+16,uni_curroffset-offset); - /* copy 0x10 bytes of 00's in the ServiceSite GUID */ - memset(pdata+offset+18,'\0',16); - - uni_curroffset += unilen; - offset += VERSION3_REFERRAL_SIZE; - } - return reply_size; -} - /****************************************************************** Set up the DFS referral for the dfs pathname. This call returns the amount of the path covered by this server, and where the -- cgit