1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* 27 * SMB: nt_cancel 28 * 29 * This SMB allows a client to cancel a request currently pending at the 30 * server. 31 * 32 * Client Request Description 33 * ================================== ================================= 34 * 35 * UCHAR WordCount; No words are sent (== 0) 36 * USHORT ByteCount; No bytes (==0) 37 * 38 * The Sid, Uid, Pid, Tid, and Mid fields of the SMB are used to locate an 39 * pending server request from this session. If a pending request is 40 * found, it is "hurried along" which may result in success or failure of 41 * the original request. No other response is generated for this SMB. 42 */ 43 44 #include <smbsrv/smb_kproto.h> 45 46 smb_sdrc_t 47 smb_pre_nt_cancel(smb_request_t *sr) 48 { 49 DTRACE_SMB_1(op__NtCancel__start, smb_request_t *, sr); 50 return (SDRC_SUCCESS); 51 } 52 53 void 54 smb_post_nt_cancel(smb_request_t *sr) 55 { 56 DTRACE_SMB_1(op__NtCancel__done, smb_request_t *, sr); 57 } 58 59 smb_sdrc_t 60 smb_com_nt_cancel(smb_request_t *sr) 61 { 62 struct smb_request *req; 63 struct smb_session *session; 64 65 session = sr->session; 66 67 smb_slist_enter(&session->s_req_list); 68 req = smb_slist_head(&session->s_req_list); 69 while (req) { 70 ASSERT(req->sr_magic == SMB_REQ_MAGIC); 71 if ((req != sr) && 72 (req->smb_uid == sr->smb_uid) && 73 (req->smb_pid == sr->smb_pid) && 74 (req->smb_tid == sr->smb_tid) && 75 (req->smb_mid == sr->smb_mid)) { 76 smb_request_cancel(req); 77 } 78 req = smb_slist_next(&session->s_req_list, req); 79 } 80 smb_slist_exit(&session->s_req_list); 81 82 /* Now, search the notify change queue to find the request */ 83 84 smb_reply_specific_cancel_request(sr); 85 86 return (SDRC_NO_REPLY); 87 } 88