/* BB FIXME investigate remapping reserved chars here */ 
CIFSSMBUnixQuerySymLink(const int xid, struct cifsTconInfo *tcon,			const unsigned char *searchName,			char *symlinkinfo, const int buflen,			const struct nls_table *nls_codepage){/* SMB_QUERY_FILE_UNIX_LINK */	TRANSACTION2_QPI_REQ *pSMB = NULL;	TRANSACTION2_QPI_RSP *pSMBr = NULL;	int rc = 0;	int bytes_returned;	int name_len;	__u16 params, byte_count;	cFYI(1, ("In QPathSymLinkInfo (Unix) for path %s", searchName));querySymLinkRetry:	rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,		      (void **) &pSMBr);	if (rc)		return rc;	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {		name_len =		    cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX				  /* find define for this maxpathcomponent */				  , nls_codepage);		name_len++;	/* trailing null */		name_len *= 2;	} else {		/* BB improve the check for buffer overruns BB */		name_len = strnlen(searchName, PATH_MAX);		name_len++;	/* trailing null */		strncpy(pSMB->FileName, searchName, name_len);	}	params = 2 /* level */  + 4 /* rsrvd */  + name_len /* incl null */ ;	pSMB->TotalDataCount = 0;	pSMB->MaxParameterCount = cpu_to_le16(2);	/* BB find exact max data count below from sess structure BB */	pSMB->MaxDataCount = cpu_to_le16(4000);	pSMB->MaxSetupCount = 0;	pSMB->Reserved = 0;	pSMB->Flags = 0;	pSMB->Timeout = 0;	pSMB->Reserved2 = 0;	pSMB->ParameterOffset = cpu_to_le16(offsetof(        struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);	pSMB->DataCount = 0;	pSMB->DataOffset = 0;	pSMB->SetupCount = 1;	pSMB->Reserved3 = 0;	pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);	byte_count = params + 1 /* pad */ ;	pSMB->TotalParameterCount = cpu_to_le16(params);	pSMB->ParameterCount = pSMB->TotalParameterCount;	pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK);	pSMB->Reserved4 = 0;	pSMB->hdr.smb_buf_length += byte_count;	pSMB->ByteCount = cpu_to_le16(byte_count);	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);	if (rc) {		cFYI(1, ("Send error in QuerySymLinkInfo = %d", rc));	} else {		/* decode response */		rc = validate_t2((struct smb_t2_rsp *)pSMBr);		if (rc || (pSMBr->ByteCount < 2))		/* BB also check enough total bytes returned */			rc = -EIO;	/* bad smb */		else {			__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);			__u16 count = le16_to_cpu(pSMBr->t2.DataCount);			if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {				name_len = UniStrnlen((wchar_t *) ((char *)					&pSMBr->hdr.Protocol +data_offset),					min_t(const int, buflen,count) / 2);				cifs_strfromUCS_le(symlinkinfo,					(wchar_t *) ((char *)&pSMBr->hdr.Protocol +						data_offset),					name_len, nls_codepage);			} else {				strncpy(symlinkinfo,					(char *) &pSMBr->hdr.Protocol + 						data_offset,					min_t(const int, buflen, count));			}			symlinkinfo[buflen] = 0;	/* just in case so calling code does not go off the end of buffer */		}	}	cifs_buf_release(pSMB);	if (rc == -EAGAIN)		goto querySymLinkRetry;	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/737b758c965a9b223ac1243ab38d9e507ac86c64/cifssmb.c/clean/fs/cifs/cifssmb.c