1*a90cf9f2SGordon Ross /* 2*a90cf9f2SGordon Ross * This file and its contents are supplied under the terms of the 3*a90cf9f2SGordon Ross * Common Development and Distribution License ("CDDL"), version 1.0. 4*a90cf9f2SGordon Ross * You may only use this file in accordance with the terms of version 5*a90cf9f2SGordon Ross * 1.0 of the CDDL. 6*a90cf9f2SGordon Ross * 7*a90cf9f2SGordon Ross * A full copy of the text of the CDDL should have accompanied this 8*a90cf9f2SGordon Ross * source. A copy of the CDDL is also available via the Internet at 9*a90cf9f2SGordon Ross * http://www.illumos.org/license/CDDL. 10*a90cf9f2SGordon Ross */ 11*a90cf9f2SGordon Ross 12*a90cf9f2SGordon Ross /* 13*a90cf9f2SGordon Ross * Copyright 2013 Nexenta Systems, Inc. All rights reserved. 14*a90cf9f2SGordon Ross */ 15*a90cf9f2SGordon Ross 16*a90cf9f2SGordon Ross /* 17*a90cf9f2SGordon Ross * Dispatch function for SMB2_LOGOFF 18*a90cf9f2SGordon Ross */ 19*a90cf9f2SGordon Ross 20*a90cf9f2SGordon Ross #include <smbsrv/smb2_kproto.h> 21*a90cf9f2SGordon Ross 22*a90cf9f2SGordon Ross smb_sdrc_t 23*a90cf9f2SGordon Ross smb2_logoff(smb_request_t *sr) 24*a90cf9f2SGordon Ross { 25*a90cf9f2SGordon Ross uint16_t StructSize; 26*a90cf9f2SGordon Ross uint16_t reserved; 27*a90cf9f2SGordon Ross int rc; 28*a90cf9f2SGordon Ross 29*a90cf9f2SGordon Ross /* 30*a90cf9f2SGordon Ross * SMB2 Logoff request 31*a90cf9f2SGordon Ross */ 32*a90cf9f2SGordon Ross rc = smb_mbc_decodef( 33*a90cf9f2SGordon Ross &sr->smb_data, "ww", 34*a90cf9f2SGordon Ross &StructSize, /* w */ 35*a90cf9f2SGordon Ross &reserved); /* w */ 36*a90cf9f2SGordon Ross if (rc) 37*a90cf9f2SGordon Ross return (SDRC_ERROR); 38*a90cf9f2SGordon Ross if (StructSize != 4) 39*a90cf9f2SGordon Ross return (SDRC_ERROR); 40*a90cf9f2SGordon Ross 41*a90cf9f2SGordon Ross if (sr->uid_user == NULL) 42*a90cf9f2SGordon Ross return (SDRC_ERROR); 43*a90cf9f2SGordon Ross smb_user_logoff(sr->uid_user); 44*a90cf9f2SGordon Ross 45*a90cf9f2SGordon Ross /* 46*a90cf9f2SGordon Ross * SMB2 Logoff reply 47*a90cf9f2SGordon Ross */ 48*a90cf9f2SGordon Ross (void) smb_mbc_encodef( 49*a90cf9f2SGordon Ross &sr->reply, "wwl", 50*a90cf9f2SGordon Ross 4, /* StructSize */ /* w */ 51*a90cf9f2SGordon Ross 0); /* reserved */ /* w */ 52*a90cf9f2SGordon Ross 53*a90cf9f2SGordon Ross return (SDRC_SUCCESS); 54*a90cf9f2SGordon Ross } 55