Index: openafs/src/LICENSE diff -c openafs/src/LICENSE:1.1 openafs/src/LICENSE:1.1.20.1 *** openafs/src/LICENSE:1.1 Sat Nov 4 03:38:12 2000 --- openafs/src/LICENSE Fri Apr 15 15:03:25 2005 *************** *** 231,233 **** --- 231,692 ---- party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + Kerberos 5 ticket support in rxkad is subject to the following copyright: + /* + * Copyright (c) 1995, 1996, 1997, 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + Some code in rxkad/ticket5.c is subject to the following copyright: + /* + * Copyright 1992, 2002 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ + + afssettings is subject to the following license: + APPLE PUBLIC SOURCE LICENSE + Version 2.0 - August 6, 2003 + + Please read this License carefully before downloading this software. + By downloading or using this software, you are agreeing to be bound by + the terms of this License. If you do not or cannot agree to the terms + of this License, please do not download or use the software. + + 1. General; Definitions. This License applies to any program or other + work which Apple Computer, Inc. ("Apple") makes publicly available and + which contains a notice placed by Apple identifying such program or + work as "Original Code" and stating that it is subject to the terms of + this Apple Public Source License version 2.0 ("License"). As used in + this License: + + 1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is + the grantor of rights, (i) claims of patents that are now or hereafter + acquired, owned by or assigned to Apple and (ii) that cover subject + matter contained in the Original Code, but only to the extent + necessary to use, reproduce and/or distribute the Original Code + without infringement; and (b) in the case where You are the grantor of + rights, (i) claims of patents that are now or hereafter acquired, + owned by or assigned to You and (ii) that cover subject matter in Your + Modifications, taken alone or in combination with Original Code. + + 1.2 "Contributor" means any person or entity that creates or + contributes to the creation of Modifications. + + 1.3 "Covered Code" means the Original Code, Modifications, the + combination of Original Code and any Modifications, and/or any + respective portions thereof. + + 1.4 "Externally Deploy" means: (a) to sublicense, distribute or + otherwise make Covered Code available, directly or indirectly, to + anyone other than You; and/or (b) to use Covered Code, alone or as + part of a Larger Work, in any way to provide a service, including but + not limited to delivery of content, through electronic communication + with a client other than You. + + 1.5 "Larger Work" means a work which combines Covered Code or portions + thereof with code not governed by the terms of this License. + + 1.6 "Modifications" mean any addition to, deletion from, and/or change + to, the substance and/or structure of the Original Code, any previous + Modifications, the combination of Original Code and any previous + Modifications, and/or any respective portions thereof. When code is + released as a series of files, a Modification is: (a) any addition to + or deletion from the contents of a file containing Covered Code; + and/or (b) any new file or other representation of computer program + statements that contains any part of Covered Code. + + 1.7 "Original Code" means (a) the Source Code of a program or other + work as originally made available by Apple under this License, + including the Source Code of any updates or upgrades to such programs + or works made available by Apple under this License, and that has been + expressly identified by Apple as such in the header file(s) of such + work; and (b) the object code compiled from such Source Code and + originally made available by Apple under this License. + + 1.8 "Source Code" means the human readable form of a program or other + work that is suitable for making modifications to it, including all + modules it contains, plus any associated interface definition files, + scripts used to control compilation and installation of an executable + (object code). + + 1.9 "You" or "Your" means an individual or a legal entity exercising + rights under this License. For legal entities, "You" or "Your" + includes any entity which controls, is controlled by, or is under + common control with, You, where "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of fifty percent + (50%) or more of the outstanding shares or beneficial ownership of + such entity. + + 2. Permitted Uses; Conditions & Restrictions. Subject to the terms + and conditions of this License, Apple hereby grants You, effective on + the date You accept this License and download the Original Code, a + world-wide, royalty-free, non-exclusive license, to the extent of + Apple's Applicable Patent Rights and copyrights covering the Original + Code, to do the following: + + 2.1 Unmodified Code. You may use, reproduce, display, perform, + internally distribute within Your organization, and Externally Deploy + verbatim, unmodified copies of the Original Code, for commercial or + non-commercial purposes, provided that in each instance: + + (a) You must retain and reproduce in all copies of Original Code the + copyright and other proprietary notices and disclaimers of Apple as + they appear in the Original Code, and keep intact all notices in the + Original Code that refer to this License; and + + (b) You must include a copy of this License with every copy of Source + Code of Covered Code and documentation You distribute or Externally + Deploy, and You may not offer or impose any terms on such Source Code + that alter or restrict this License or the recipients' rights + hereunder, except as permitted under Section 6. + + 2.2 Modified Code. You may modify Covered Code and use, reproduce, + display, perform, internally distribute within Your organization, and + Externally Deploy Your Modifications and Covered Code, for commercial + or non-commercial purposes, provided that in each instance You also + meet all of these conditions: + + (a) You must satisfy all the conditions of Section 2.1 with respect to + the Source Code of the Covered Code; + + (b) You must duplicate, to the extent it does not already exist, the + notice in Exhibit A in each file of the Source Code of all Your + Modifications, and cause the modified files to carry prominent notices + stating that You changed the files and the date of any change; and + + (c) If You Externally Deploy Your Modifications, You must make + Source Code of all Your Externally Deployed Modifications either + available to those to whom You have Externally Deployed Your + Modifications, or publicly available. Source Code of Your Externally + Deployed Modifications must be released under the terms set forth in + this License, including the license grants set forth in Section 3 + below, for as long as you Externally Deploy the Covered Code or twelve + (12) months from the date of initial External Deployment, whichever is + longer. You should preferably distribute the Source Code of Your + Externally Deployed Modifications electronically (e.g. download from a + web site). + + 2.3 Distribution of Executable Versions. In addition, if You + Externally Deploy Covered Code (Original Code and/or Modifications) in + object code, executable form only, You must include a prominent + notice, in the code itself as well as in related documentation, + stating that Source Code of the Covered Code is available under the + terms of this License with information on how and where to obtain such + Source Code. + + 2.4 Third Party Rights. You expressly acknowledge and agree that + although Apple and each Contributor grants the licenses to their + respective portions of the Covered Code set forth herein, no + assurances are provided by Apple or any Contributor that the Covered + Code does not infringe the patent or other intellectual property + rights of any other entity. Apple and each Contributor disclaim any + liability to You for claims brought by any other entity based on + infringement of intellectual property rights or otherwise. As a + condition to exercising the rights and licenses granted hereunder, You + hereby assume sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party patent + license is required to allow You to distribute the Covered Code, it is + Your responsibility to acquire that license before distributing the + Covered Code. + + 3. Your Grants. In consideration of, and as a condition to, the + licenses granted to You under this License, You hereby grant to any + person or entity receiving or distributing Covered Code under this + License a non-exclusive, royalty-free, perpetual, irrevocable license, + under Your Applicable Patent Rights and other intellectual property + rights (other than patent) owned or controlled by You, to use, + reproduce, display, perform, modify, sublicense, distribute and + Externally Deploy Your Modifications of the same scope and extent as + Apple's licenses under Sections 2.1 and 2.2 above. + + 4. Larger Works. You may create a Larger Work by combining Covered + Code with other code not governed by the terms of this License and + distribute the Larger Work as a single product. In each such instance, + You must make sure the requirements of this License are fulfilled for + the Covered Code or any portion thereof. + + 5. Limitations on Patent License. Except as expressly stated in + Section 2, no other patent rights, express or implied, are granted by + Apple herein. Modifications and/or Larger Works may require additional + patent licenses from Apple which Apple may grant in its sole + discretion. + + 6. Additional Terms. You may choose to offer, and to charge a fee for, + warranty, support, indemnity or liability obligations and/or other + rights consistent with the scope of the license granted herein + ("Additional Terms") to one or more recipients of Covered Code. + However, You may do so only on Your own behalf and as Your sole + responsibility, and not on behalf of Apple or any Contributor. You + must obtain the recipient's agreement that any such Additional Terms + are offered by You alone, and You hereby agree to indemnify, defend + and hold Apple and every Contributor harmless for any liability + incurred by or claims asserted against Apple or such Contributor by + reason of any such Additional Terms. + + 7. Versions of the License. Apple may publish revised and/or new + versions of this License from time to time. Each version will be given + a distinguishing version number. Once Original Code has been published + under a particular version of this License, You may continue to use it + under the terms of that version. You may also choose to use such + Original Code under the terms of any subsequent version of this + License published by Apple. No one other than Apple has the right to + modify the terms applicable to Covered Code created under this + License. + + 8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in + part pre-release, untested, or not fully tested works. The Covered + Code may contain errors that could cause failures or loss of data, and + may be incomplete or contain inaccuracies. You expressly acknowledge + and agree that use of the Covered Code, or any portion thereof, is at + Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND + WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND + APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE + PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM + ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF + MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR + PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD + PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST + INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE + FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS, + THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR + ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO + ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE + AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. + You acknowledge that the Covered Code is not intended for use in the + operation of nuclear facilities, aircraft navigation, communication + systems, or air traffic control machines in which case the failure of + the Covered Code could lead to death, personal injury, or severe + physical or environmental damage. + + 9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO + EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING + TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR + ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY, + TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF + APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY + REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF + INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY + TO YOU. In no event shall Apple's total liability to You for all + damages (other than as may be required by applicable law) under this + License exceed the amount of fifty dollars ($50.00). + + 10. Trademarks. This License does not grant any rights to use the + trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS", + "QuickTime", "QuickTime Streaming Server" or any other trademarks, + service marks, logos or trade names belonging to Apple (collectively + "Apple Marks") or to any trademark, service mark, logo or trade name + belonging to any Contributor. You agree not to use any Apple Marks in + or as part of the name of products derived from the Original Code or + to endorse or promote products derived from the Original Code other + than as expressly permitted by and in strict compliance at all times + with Apple's third party trademark usage guidelines which are posted + at http://www.apple.com/legal/guidelinesfor3rdparties.html. + + 11. Ownership. Subject to the licenses granted under this License, + each Contributor retains all rights, title and interest in and to any + Modifications made by such Contributor. Apple retains all rights, + title and interest in and to the Original Code and any Modifications + made by or on behalf of Apple ("Apple Modifications"), and such Apple + Modifications will not be automatically subject to this License. Apple + may, at its sole discretion, choose to license such Apple + Modifications under this License, or on different terms from those + contained in this License or may choose not to license them at all. + + 12. Termination. + + 12.1 Termination. This License and the rights granted hereunder will + terminate: + + (a) automatically without notice from Apple if You fail to comply with + any term(s) of this License and fail to cure such breach within 30 + days of becoming aware of such breach; + + (b) immediately in the event of the circumstances described in Section + 13.5(b); or + + (c) automatically without notice from Apple if You, at any time during + the term of this License, commence an action for patent infringement + against Apple; provided that Apple did not first commence + an action for patent infringement against You in that instance. + + 12.2 Effect of Termination. Upon termination, You agree to immediately + stop any further use, reproduction, modification, sublicensing and + distribution of the Covered Code. All sublicenses to the Covered Code + which have been properly granted prior to termination shall survive + any termination of this License. Provisions which, by their nature, + should remain in effect beyond the termination of this License shall + survive, including but not limited to Sections 3, 5, 8, 9, 10, 11, + 12.2 and 13. No party will be liable to any other for compensation, + indemnity or damages of any sort solely as a result of terminating + this License in accordance with its terms, and termination of this + License will be without prejudice to any other right or remedy of + any party. + + 13. Miscellaneous. + + 13.1 Government End Users. The Covered Code is a "commercial item" as + defined in FAR 2.101. Government software and technical data rights in + the Covered Code include only those rights customarily provided to the + public as defined in this License. This customary commercial license + in technical data and software is provided in accordance with FAR + 12.211 (Technical Data) and 12.212 (Computer Software) and, for + Department of Defense purchases, DFAR 252.227-7015 (Technical Data -- + Commercial Items) and 227.7202-3 (Rights in Commercial Computer + Software or Computer Software Documentation). Accordingly, all U.S. + Government End Users acquire Covered Code with only those rights set + forth herein. + + 13.2 Relationship of Parties. This License will not be construed as + creating an agency, partnership, joint venture or any other form of + legal association between or among You, Apple or any Contributor, and + You will not represent to the contrary, whether expressly, by + implication, appearance or otherwise. + + 13.3 Independent Development. Nothing in this License will impair + Apple's right to acquire, license, develop, have others develop for + it, market and/or distribute technology or products that perform the + same or similar functions as, or otherwise compete with, + Modifications, Larger Works, technology or products that You may + develop, produce, market or distribute. + + 13.4 Waiver; Construction. Failure by Apple or any Contributor to + enforce any provision of this License will not be deemed a waiver of + future enforcement of that or any other provision. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter will not apply to this License. + + 13.5 Severability. (a) If for any reason a court of competent + jurisdiction finds any provision of this License, or portion thereof, + to be unenforceable, that provision of the License will be enforced to + the maximum extent permissible so as to effect the economic benefits + and intent of the parties, and the remainder of this License will + continue in full force and effect. (b) Notwithstanding the foregoing, + if applicable law prohibits or restricts You from fully and/or + specifically complying with Sections 2 and/or 3 or prevents the + enforceability of either of those Sections, this License will + immediately terminate and You must immediately discontinue any use of + the Covered Code and destroy all copies of it that are in your + possession or control. + + 13.6 Dispute Resolution. Any litigation or other dispute resolution + between You and Apple relating to this License shall take place in the + Northern District of California, and You and Apple hereby consent to + the personal jurisdiction of, and venue in, the state and federal + courts within that District with respect to this License. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. + + 13.7 Entire Agreement; Governing Law. This License constitutes the + entire agreement between the parties with respect to the subject + matter hereof. This License shall be governed by the laws of the + United States and the State of California, except that body of + California law concerning conflicts of law. + + Where You are located in the province of Quebec, Canada, the following + clause applies: The parties hereby confirm that they have requested + that this License and all related documents be drafted in English. Les + parties ont exige que le present contrat et tous les documents + connexes soient rediges en anglais. + + EXHIBIT A. + + "Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights + Reserved. + + This file contains Original Code and/or Modifications of Original Code + as defined in and that are subject to the Apple Public Source License + Version 2.0 (the 'License'). You may not use this file except in + compliance with the License. Please obtain a copy of the License at + http://www.opensource.apple.com/apsl/ and read it before using this + file. + + The Original Code and all software distributed under the License are + distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + Please see the License for the specific language governing rights and + limitations under the License." + + Some portions of Rx are subject to the following license: + /* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user or with the express written consent of + * Sun Microsystems, Inc. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ Index: openafs/src/WINNT/afsapplib/.cvsignore diff -c /dev/null openafs/src/WINNT/afsapplib/.cvsignore:1.1.2.2 *** /dev/null Thu Apr 28 22:55:43 2005 --- openafs/src/WINNT/afsapplib/.cvsignore Thu Apr 28 08:00:53 2005 *************** *** 0 **** --- 1,2 ---- + AFS_component_version_number.h + lang/AFS_component_version_number.h Index: openafs/src/WINNT/afsd/NTMakefile diff -c openafs/src/WINNT/afsd/NTMakefile:1.27.2.7 openafs/src/WINNT/afsd/NTMakefile:1.27.2.8 *** openafs/src/WINNT/afsd/NTMakefile:1.27.2.7 Fri Mar 11 01:58:37 2005 --- openafs/src/WINNT/afsd/NTMakefile Thu Apr 28 08:05:19 2005 *************** *** 213,227 **** LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll LOGON_DLLOBJS =\ ! $(OUT)\afslogon.obj \ $(OUT)\logon_ad.obj \ ! $(OUT)\afslogon.res LOGON_DLLLIBS =\ ! $(DESTDIR)\lib\afsauthent.lib \ ! $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afsdes.lib \ $(AFSKFWLIB) LOGON_DLLSDKLIBS =\ --- 213,228 ---- LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll LOGON_DLLOBJS =\ ! $(OUT)\afslogon.obj \ $(OUT)\logon_ad.obj \ ! $(OUT)\afslogon.res LOGON_DLLLIBS =\ ! $(DESTDIR)\lib\afsauthent.lib \ ! $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afsdes.lib \ + $(LANAHELPERLIB) \ $(AFSKFWLIB) LOGON_DLLSDKLIBS =\ Index: openafs/src/WINNT/afsd/afsd.c diff -c openafs/src/WINNT/afsd/afsd.c:1.8.2.1 openafs/src/WINNT/afsd/afsd.c:1.8.2.2 *** openafs/src/WINNT/afsd/afsd.c:1.8.2.1 Fri Nov 5 14:21:42 2004 --- openafs/src/WINNT/afsd/afsd.c Tue Apr 19 02:27:57 2005 *************** *** 36,41 **** --- 36,43 ---- extern void afsd_DbgBreakAllocInit(); extern void afsd_DbgBreakAdd(DWORD requestNumber); + HANDLE WaitToTerminate = NULL; + /* * Notifier function for use by osi_panic */ Index: openafs/src/WINNT/afsd/afsd.h diff -c openafs/src/WINNT/afsd/afsd.h:1.5.2.3 openafs/src/WINNT/afsd/afsd.h:1.5.2.5 *** openafs/src/WINNT/afsd/afsd.h:1.5.2.3 Mon Apr 4 22:17:15 2005 --- openafs/src/WINNT/afsd/afsd.h Tue Apr 19 17:07:14 2005 *************** *** 123,128 **** --- 123,130 ---- extern long rx_mtu; + extern HANDLE WaitToTerminate; + #define CAPABILITY_ERRORTRANS (1<<0) #define CAPABILITY_BITS 1 *************** *** 130,133 **** --- 132,150 ---- #define LOG_PACKET 1 #undef NOTSERVICE + #define AFSD_HOOK_DLL "afsdhook.dll" + #define AFSD_INIT_HOOK "AfsdInitHook" + typedef BOOL ( APIENTRY * AfsdInitHook )(void); + #define AFSD_RX_STARTED_HOOK "AfsdRxStartedHook" + typedef BOOL ( APIENTRY * AfsdRxStartedHook )(void); + #define AFSD_SMB_STARTED_HOOK "AfsdSmbStartedHook" + typedef BOOL ( APIENTRY * AfsdSmbStartedHook )(void); + #define AFSD_STARTED_HOOK "AfsdStartedHook" + typedef BOOL ( APIENTRY * AfsdStartedHook )(void); + #define AFSD_DAEMON_HOOK "AfsdDaemonHook" + typedef BOOL ( APIENTRY * AfsdDaemonHook )(void); + #define AFSD_STOPPING_HOOK "AfsdStoppingHook" + typedef BOOL ( APIENTRY * AfsdStoppingHook )(void); + #define AFSD_STOPPED_HOOK "AfsdStoppedHook" + typedef BOOL ( APIENTRY * AfsdStoppedHook )(void); #endif /* AFSD_H_ENV */ Index: openafs/src/WINNT/afsd/afsd_service.c diff -c openafs/src/WINNT/afsd/afsd_service.c:1.28.2.13 openafs/src/WINNT/afsd/afsd_service.c:1.28.2.15 *** openafs/src/WINNT/afsd/afsd_service.c:1.28.2.13 Fri Mar 11 01:58:38 2005 --- openafs/src/WINNT/afsd/afsd_service.c Tue Apr 19 17:07:14 2005 *************** *** 987,996 **** return success; } - typedef BOOL ( APIENTRY * AfsdInitHook )(void); - #define AFSD_INIT_HOOK "AfsdInitHook" - #define AFSD_HOOK_DLL "afsdhook.dll" - /* control serviceex exists only on 2000/xp. These functions will be loaded dynamically. */ --- 987,992 ---- *************** *** 1009,1017 **** #ifdef JUMP int jmpret; #endif /* JUMP */ ! HANDLE hInitHookDll; ! HANDLE hAdvApi32; ! AfsdInitHook initHook; #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_ALWAYS_DF*/ | --- 1005,1012 ---- #ifdef JUMP int jmpret; #endif /* JUMP */ ! HMODULE hHookDll; ! HMODULE hAdvApi32; #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_ALWAYS_DF*/ | *************** *** 1109,1125 **** } /* allow an exit to be called prior to any initialization */ ! hInitHookDll = LoadLibrary(AFSD_HOOK_DLL); ! if (hInitHookDll) { ! BOOL hookRc = FALSE; ! initHook = ( AfsdInitHook ) GetProcAddress(hInitHookDll, AFSD_INIT_HOOK); if (initHook) { hookRc = initHook(); } ! FreeLibrary(hInitHookDll); ! hInitHookDll = NULL; if (hookRc == FALSE) { --- 1104,1120 ---- } /* allow an exit to be called prior to any initialization */ ! hHookDll = LoadLibrary(AFSD_HOOK_DLL); ! if (hHookDll) { ! BOOL hookRc = TRUE; ! AfsdInitHook initHook = ( AfsdInitHook ) GetProcAddress(hHookDll, AFSD_INIT_HOOK); if (initHook) { hookRc = initHook(); } ! FreeLibrary(hHookDll); ! hHookDll = NULL; if (hookRc == FALSE) { *************** *** 1172,1177 **** --- 1167,1199 ---- osi_panic(reason, __FILE__, __LINE__); } + /* allow an exit to be called post rx initialization */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdRxStartedHook rxStartedHook = ( AfsdRxStartedHook ) GetProcAddress(hHookDll, AFSD_RX_STARTED_HOOK); + if (rxStartedHook) + { + hookRc = rxStartedHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + + if (hookRc == FALSE) + { + ServiceStatus.dwCurrentState = SERVICE_STOPPED; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); + + /* exit if initialization failed */ + return; + } + } + #ifndef NOTSERVICE ServiceStatus.dwCheckPoint++; ServiceStatus.dwWaitHint -= 5000; *************** *** 1183,1188 **** --- 1205,1237 ---- osi_panic(reason, __FILE__, __LINE__); } + /* allow an exit to be called post smb initialization */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdSmbStartedHook smbStartedHook = ( AfsdSmbStartedHook ) GetProcAddress(hHookDll, AFSD_SMB_STARTED_HOOK); + if (smbStartedHook) + { + hookRc = smbStartedHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + + if (hookRc == FALSE) + { + ServiceStatus.dwCurrentState = SERVICE_STOPPED; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); + + /* exit if initialization failed */ + return; + } + } + MountGlobalDrives(); #ifndef NOTSERVICE *************** *** 1204,1209 **** --- 1253,1285 ---- } } + /* allow an exit to be called when started */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdStartedHook startedHook = ( AfsdStartedHook ) GetProcAddress(hHookDll, AFSD_STARTED_HOOK); + if (startedHook) + { + hookRc = startedHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + + if (hookRc == FALSE) + { + ServiceStatus.dwCurrentState = SERVICE_STOPPED; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); + + /* exit if initialization failed */ + return; + } + } + WaitForSingleObject(WaitToTerminate, INFINITE); afsi_log("Received Termination Signal, Stopping Service"); *************** *** 1217,1222 **** --- 1293,1326 ---- DeregisterEventSource(h); } + /* allow an exit to be called prior to stopping the service */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdStoppingHook stoppingHook = ( AfsdStoppingHook ) GetProcAddress(hHookDll, AFSD_STOPPING_HOOK); + if (stoppingHook) + { + hookRc = stoppingHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + + if (hookRc == FALSE) + { + ServiceStatus.dwCurrentState = SERVICE_STOPPED; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); + + /* exit if initialization failed */ + return; + } + } + + #ifdef AFS_FREELANCE_CLIENT cm_FreelanceShutdown(); afsi_log("Freelance Shutdown complete"); *************** *** 1247,1252 **** --- 1351,1370 ---- PowerNotificationThreadExit(); #endif + /* allow an exit to be called after stopping the service */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdStoppedHook stoppedHook = ( AfsdStoppedHook ) GetProcAddress(hHookDll, AFSD_STOPPED_HOOK); + if (stoppedHook) + { + hookRc = stoppedHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + } + /* Remove the ExceptionFilter */ SetUnhandledExceptionFilter(NULL); Index: openafs/src/WINNT/afsd/afskfw.c diff -c openafs/src/WINNT/afsd/afskfw.c:1.8.2.10 openafs/src/WINNT/afsd/afskfw.c:1.8.2.11 *** openafs/src/WINNT/afsd/afskfw.c:1.8.2.10 Fri Mar 11 01:58:38 2005 --- openafs/src/WINNT/afsd/afskfw.c Tue Apr 19 01:11:17 2005 *************** *** 3409,3411 **** --- 3409,3457 ---- return serverReachable; } + BOOL + KFW_AFS_get_lsa_principal(char * szUser, DWORD *dwSize) + { + krb5_context ctx = 0; + krb5_error_code code; + krb5_ccache mslsa_ccache=0; + krb5_principal princ = 0; + char * pname = 0; + BOOL success = 0; + + if (!KFW_is_available()) + return FALSE; + + if (code = pkrb5_init_context(&ctx)) + goto cleanup; + + if (code = pkrb5_cc_resolve(ctx, "MSLSA:", &mslsa_ccache)) + goto cleanup; + + if (code = pkrb5_cc_get_principal(ctx, mslsa_ccache, &princ)) + goto cleanup; + + if (code = pkrb5_unparse_name(ctx, princ, &pname)) + goto cleanup; + + if ( strlen(pname) < *dwSize ) { + strncpy(szUser, pname, *dwSize); + szUser[*dwSize-1] = '\0'; + success = 1; + } + *dwSize = strlen(pname); + + cleanup: + if (pname) + pkrb5_free_unparsed_name(ctx, pname); + + if (princ) + pkrb5_free_principal(ctx, princ); + + if (mslsa_ccache) + pkrb5_cc_close(ctx, mslsa_ccache); + + if (ctx) + pkrb5_free_context(ctx); + return success; + } \ No newline at end of file Index: openafs/src/WINNT/afsd/afskfw.h diff -c openafs/src/WINNT/afsd/afskfw.h:1.2 openafs/src/WINNT/afsd/afskfw.h:1.2.2.1 *** openafs/src/WINNT/afsd/afskfw.h:1.2 Thu May 6 16:46:31 2004 --- openafs/src/WINNT/afsd/afskfw.h Tue Apr 19 01:11:17 2005 *************** *** 60,65 **** --- 60,66 ---- BOOL KFW_probe_kdc(struct afsconf_cell *); int KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *); void KFW_import_windows_lsa(void); + BOOL KFW_AFS_get_lsa_principal(char *, DWORD *); /* From afs/krb_prot.h */ /* values for kerb error codes */ Index: openafs/src/WINNT/afsd/afslogon.c diff -c openafs/src/WINNT/afsd/afslogon.c:1.24.2.8 openafs/src/WINNT/afsd/afslogon.c:1.24.2.9 *** openafs/src/WINNT/afsd/afslogon.c:1.24.2.8 Wed Mar 23 17:31:45 2005 --- openafs/src/WINNT/afsd/afslogon.c Tue Apr 19 01:11:17 2005 *************** *** 16,21 **** --- 16,22 ---- #include #include + #include #include #include *************** *** 26,31 **** --- 27,33 ---- #include "cm_config.h" #include "krb.h" #include "afskfw.h" + #include "lanahelper.h" #include *************** *** 561,568 **** } if (hkTemp) { - HRESULT hr; - size_t len; CHAR * thesecells; /* dwSize still has the size of the required buffer in bytes. */ --- 563,568 ---- *************** *** 988,999 **** DWORD len = 1024; PTOKEN_USER tokenUser = NULL; DWORD retLen; - HANDLE hToken; /* Make sure the AFS Libraries are initialized */ AfsLogonInit(); ! DebugEvent0("AFS_Logoff_Event - Starting"); if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen)) { --- 988,998 ---- DWORD len = 1024; PTOKEN_USER tokenUser = NULL; DWORD retLen; /* Make sure the AFS Libraries are initialized */ AfsLogonInit(); ! DebugEvent0("AFS_Logoff_Event - Start"); if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen)) { *************** *** 1002,1008 **** if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen)) { ! DebugEvent("GetTokenInformation failed: GLE = %lX", GetLastError()); } } } --- 1001,1007 ---- if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen)) { ! DebugEvent("AFS_Logoff_Event - GetTokenInformation failed: GLE = %lX", GetLastError()); } } } *************** *** 1020,1026 **** } if (strlen(profileDir)) { ! DebugEvent("Profile Directory: %s", profileDir); if (!IsPathInAfs(profileDir)) { if (code = ktc_ForgetAllTokens()) DebugEvent("AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code); --- 1019,1025 ---- } if (strlen(profileDir)) { ! DebugEvent("AFS_Logoff_Event - Profile Directory: %s", profileDir); if (!IsPathInAfs(profileDir)) { if (code = ktc_ForgetAllTokens()) DebugEvent("AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code); *************** *** 1035,1039 **** --- 1034,1125 ---- if ( tokenUser ) LocalFree(tokenUser); + + DebugEvent0("AFS_Logoff_Event - End"); } + VOID AFS_Logon_Event( PWLX_NOTIFICATION_INFO pInfo ) + { + DWORD code; + TCHAR profileDir[1024] = TEXT(""); + DWORD len = 1024; + PTOKEN_USER tokenUser = NULL; + DWORD retLen; + HANDLE hToken; + + WCHAR szUserW[128] = L""; + char szUserA[128] = ""; + char szClient[MAX_PATH]; + char szPath[MAX_PATH] = ""; + NETRESOURCE nr; + DWORD res; + DWORD gle; + DWORD dwSize; + + /* Make sure the AFS Libraries are initialized */ + AfsLogonInit(); + + DebugEvent0("AFS_Logon_Event - Start"); + + if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen)) + { + if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER ) { + tokenUser = (PTOKEN_USER) LocalAlloc(LPTR, retLen); + + if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen)) + { + DebugEvent("AFS_Logon_Event - GetTokenInformation failed: GLE = %lX", GetLastError()); + } + } + } + + /* We can't use pInfo->Domain for the domain since in the cross realm case + * this is source domain and not the destination domain. + */ + if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { + WCHAR Domain[64]=L""; + GetLocalShortDomain(Domain, sizeof(Domain)); + if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) { + if (NetUserGetProfilePath(pInfo->Domain, pInfo->UserName, profileDir, len)) + GetUserProfileDirectory(pInfo->hToken, profileDir, &len); + } + } + + if (strlen(profileDir)) { + DebugEvent("AFS_Logon_Event - Profile Directory: %s", profileDir); + } else { + DebugEvent0("AFS_Logon_Event - Unable to load profile"); + } + + dwSize = sizeof(szUserA); + if (!KFW_AFS_get_lsa_principal(szUserA, &dwSize)) { + StringCbPrintfW(szUserW, sizeof(szUserW), L"%s\\%s", pInfo->Domain, pInfo->UserName); + WideCharToMultiByte(CP_ACP, 0, szUserW, -1, szUserA, MAX_PATH, NULL, NULL); + } + + if (szUserA[0]) + { + lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL); + StringCbPrintf(szPath, sizeof(szPath), "\\\\%s", szClient); + + DebugEvent("AFS_Logon_Event - Logon Name: %s", szUserA); + + memset (&nr, 0x00, sizeof(NETRESOURCE)); + nr.dwType=RESOURCETYPE_DISK; + nr.lpLocalName=0; + nr.lpRemoteName=szPath; + res = WNetAddConnection2(&nr,NULL,szUserA,0); + if (res) + DebugEvent("AFS_Logon_Event - WNetAddConnection2(%s,%s) failed: 0x%X", + szPath, szUserA,res); + else + DebugEvent0("AFS_Logon_Event - WNetAddConnection2() succeeded"); + } else + DebugEvent("AFS_Logon_Event - User name conversion failed: GLE = 0x%X",GetLastError()); + + if ( tokenUser ) + LocalFree(tokenUser); + + DebugEvent0("AFS_Logon_Event - End"); + } + Index: openafs/src/WINNT/afsd/afslogon.def diff -c openafs/src/WINNT/afsd/afslogon.def:1.3 openafs/src/WINNT/afsd/afslogon.def:1.3.2.1 *** openafs/src/WINNT/afsd/afslogon.def:1.3 Thu Jul 22 05:23:52 2004 --- openafs/src/WINNT/afsd/afslogon.def Thu Apr 28 08:05:19 2005 *************** *** 10,14 **** --- 10,15 ---- NPPasswordChangeNotify AFS_Startup_Event AFS_Logoff_Event + AFS_Logon_Event Index: openafs/src/WINNT/afsd/cm_aclent.c diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.5 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.6 *** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.5 Fri Mar 11 01:58:39 2005 --- openafs/src/WINNT/afsd/cm_aclent.c Tue Apr 19 01:11:17 2005 *************** *** 37,53 **** cm_aclent_t **laclpp; if (aclp->backp) { ! /* ! * Remove the entry from the vnode's list ! */ ! laclpp = &aclp->backp->randomACLp; ! for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) { ! if (taclp == aclp) ! break; ! } ! if (!taclp) ! osi_panic("CleanupACLEnt race", __FILE__, __LINE__); ! *laclpp = aclp->nextp; /* remove from vnode list */ aclp->backp = NULL; } --- 37,56 ---- cm_aclent_t **laclpp; if (aclp->backp) { ! if (aclp->backp->randomACLp) { ! /* ! * Remove the entry from the vnode's list ! */ ! lock_AssertMutex(&aclp->backp->mx); ! laclpp = &aclp->backp->randomACLp; ! for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) { ! if (taclp == aclp) ! break; ! } ! if (!taclp) ! osi_panic("CleanupACLEnt race", __FILE__, __LINE__); ! *laclpp = aclp->nextp; /* remove from vnode list */ ! } aclp->backp = NULL; } *************** *** 110,119 **** * This function returns a free (not in the LRU queue) acl cache entry. * It must be called with the cm_aclLock lock held */ ! static cm_aclent_t *GetFreeACLEnt(void) { cm_aclent_t *aclp; ! if (cm_data.aclLRUp == NULL) osi_panic("empty aclent LRU", __FILE__, __LINE__); --- 113,123 ---- * This function returns a free (not in the LRU queue) acl cache entry. * It must be called with the cm_aclLock lock held */ ! static cm_aclent_t *GetFreeACLEnt(cm_scache_t * scp) { cm_aclent_t *aclp; ! cm_scache_t *ascp = 0; ! if (cm_data.aclLRUp == NULL) osi_panic("empty aclent LRU", __FILE__, __LINE__); *************** *** 121,128 **** --- 125,138 ---- cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q); osi_QRemove((osi_queue_t **) &cm_data.aclLRUp, &aclp->q); + if (aclp->backp && scp != aclp->backp) { + ascp = aclp->backp; + lock_ObtainMutex(&ascp->mx); + } CleanupACLEnt(aclp); + if (ascp) + lock_ReleaseMutex(&ascp->mx); return aclp; } *************** *** 153,159 **** * and reuse. But first try the free list and see if there's already * someone there. */ ! aclp = GetFreeACLEnt(); /* can't fail, panics instead */ osi_QAddH((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q); aclp->backp = scp; aclp->nextp = scp->randomACLp; --- 163,169 ---- * and reuse. But first try the free list and see if there's already * someone there. */ ! aclp = GetFreeACLEnt(scp); /* can't fail, panics instead */ osi_QAddH((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q); aclp->backp = scp; aclp->nextp = scp->randomACLp; Index: openafs/src/WINNT/afsd/cm_callback.c diff -c openafs/src/WINNT/afsd/cm_callback.c:1.20.2.10 openafs/src/WINNT/afsd/cm_callback.c:1.20.2.11 *** openafs/src/WINNT/afsd/cm_callback.c:1.20.2.10 Mon Apr 4 22:17:15 2005 --- openafs/src/WINNT/afsd/cm_callback.c Wed Apr 27 11:32:52 2005 *************** *** 1499,1504 **** --- 1499,1505 ---- cm_racingRevokes_t *nrevp; /* where we'll be next */ int freeFlag; cm_server_t * serverp = 0; + int discardScp = 0; lock_ObtainWrite(&cm_callbackLock); if (flags & CM_CALLBACK_MAINTAINCOUNT) { *************** *** 1561,1576 **** scp, cbrp->callbackCount, revp->callbackCount, cm_callbackCount); ! cm_DiscardSCache(scp); ! /* ! * Since we don't have a callback to preserve, it's ! * OK to drop the lock and re-obtain it. ! */ ! lock_ReleaseMutex(&scp->mx); ! lock_ReleaseWrite(&cm_callbackLock); ! cm_CallbackNotifyChange(scp); ! lock_ObtainMutex(&scp->mx); ! lock_ObtainWrite(&cm_callbackLock); } if (freeFlag) free(revp); --- 1562,1568 ---- scp, cbrp->callbackCount, revp->callbackCount, cm_callbackCount); ! discardScp = 1; } if (freeFlag) free(revp); *************** *** 1582,1587 **** --- 1574,1586 ---- lock_ReleaseWrite(&cm_callbackLock); + if ( discardScp ) { + cm_DiscardSCache(scp); + lock_ReleaseMutex(&scp->mx); + cm_CallbackNotifyChange(scp); + lock_ObtainMutex(&scp->mx); + } + if ( serverp ) { lock_ObtainWrite(&cm_serverLock); cm_FreeServer(serverp); Index: openafs/src/WINNT/afsd/cm_daemon.c diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.2 openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.5 *** openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.2 Fri Mar 11 01:58:41 2005 --- openafs/src/WINNT/afsd/cm_daemon.c Tue Apr 19 17:07:14 2005 *************** *** 21,26 **** --- 21,27 ---- #include #include + #include #include "afsd.h" *************** *** 42,47 **** --- 43,50 ---- { cm_bkgRequest_t *rp; + rx_StartClientThread(); + lock_ObtainWrite(&cm_daemonLock); while (daemon_ShutdownFlag == 0) { if (!cm_bkgListEndp) { *************** *** 109,114 **** --- 112,118 ---- char thostName[200]; unsigned long code; struct hostent *thp; + HMODULE hHookDll; /* ping all file servers, up or down, with unauthenticated connection, * to find out whether we have all our callbacks from the server still. *************** *** 176,181 **** --- 180,204 ---- lastTokenCacheCheck = now; cm_CheckTokenCache(now); } + + /* allow an exit to be called prior to stopping the service */ + hHookDll = LoadLibrary(AFSD_HOOK_DLL); + if (hHookDll) + { + BOOL hookRc = TRUE; + AfsdDaemonHook daemonHook = ( AfsdDaemonHook ) GetProcAddress(hHookDll, AFSD_DAEMON_HOOK); + if (daemonHook) + { + hookRc = daemonHook(); + } + FreeLibrary(hHookDll); + hHookDll = NULL; + + if (hookRc == FALSE) + { + SetEvent(WaitToTerminate); + } + } } } Index: openafs/src/WINNT/afsd/cm_memmap.c diff -c openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.1 openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.2 *** openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.1 Fri Mar 11 02:22:40 2005 --- openafs/src/WINNT/afsd/cm_memmap.c Tue Apr 19 01:11:17 2005 *************** *** 102,114 **** } DWORD ! ComputeSizeOfMappingFile(DWORD stats, DWORD chunkSize, DWORD cacheBlocks, DWORD blockSize) { DWORD size; size = ComputeSizeOfConfigData() ! + ComputeSizeOfVolumes(stats/2) ! + ComputeSizeOfCells(stats/4) + ComputeSizeOfACLCache(stats) + ComputeSizeOfSCache(stats) + ComputeSizeOfSCacheHT(stats) --- 102,114 ---- } DWORD ! ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, DWORD cacheBlocks, DWORD blockSize) { DWORD size; size = ComputeSizeOfConfigData() ! + ComputeSizeOfVolumes(maxVols) ! + ComputeSizeOfCells(maxCells) + ComputeSizeOfACLCache(stats) + ComputeSizeOfSCache(stats) + ComputeSizeOfSCacheHT(stats) *************** *** 417,427 **** PSECURITY_ATTRIBUTES psa; int newFile = 1; DWORD mappingSize; char * baseAddress = NULL; cm_config_data_t * config_data_p; char * p; ! mappingSize = ComputeSizeOfMappingFile(stats, chunkSize, cacheBlocks, CM_CONFIGDEFAULT_BLOCKSIZE); if ( !virtualCache ) { psa = CreateCacheFileSA(); --- 417,429 ---- PSECURITY_ATTRIBUTES psa; int newFile = 1; DWORD mappingSize; + DWORD maxVols = stats/2; + DWORD maxCells = stats/4; char * baseAddress = NULL; cm_config_data_t * config_data_p; char * p; ! mappingSize = ComputeSizeOfMappingFile(stats, maxVols, maxCells, chunkSize, cacheBlocks, CM_CONFIGDEFAULT_BLOCKSIZE); if ( !virtualCache ) { psa = CreateCacheFileSA(); *************** *** 529,534 **** --- 531,538 ---- if ( config_data_p->size == sizeof(cm_config_data_t) && config_data_p->magic == CM_CONFIG_DATA_MAGIC && config_data_p->stats == stats && + config_data_p->maxVolumes == maxVols && + config_data_p->maxCells == maxCells && config_data_p->chunkSize == chunkSize && config_data_p->buf_nbuffers == cacheBlocks && config_data_p->blockSize == CM_CONFIGDEFAULT_BLOCKSIZE && *************** *** 622,630 **** baseAddress += ComputeSizeOfConfigData(); cm_data.volumeBaseAddress = (cm_volume_t *) baseAddress; ! baseAddress += ComputeSizeOfVolumes(stats/2); cm_data.cellBaseAddress = (cm_cell_t *) baseAddress; ! baseAddress += ComputeSizeOfCells(stats/4); cm_data.aclBaseAddress = (cm_aclent_t *) baseAddress; baseAddress += ComputeSizeOfACLCache(stats); cm_data.scacheBaseAddress = (cm_scache_t *) baseAddress; --- 626,634 ---- baseAddress += ComputeSizeOfConfigData(); cm_data.volumeBaseAddress = (cm_volume_t *) baseAddress; ! baseAddress += ComputeSizeOfVolumes(maxVols); cm_data.cellBaseAddress = (cm_cell_t *) baseAddress; ! baseAddress += ComputeSizeOfCells(maxCells); cm_data.aclBaseAddress = (cm_aclent_t *) baseAddress; baseAddress += ComputeSizeOfACLCache(stats); cm_data.scacheBaseAddress = (cm_scache_t *) baseAddress; *************** *** 653,662 **** RpcStringFree(&p); afsi_log("Initializing Volume Data"); ! cm_InitVolume(newFile, stats/2); afsi_log("Initializing Cell Data"); ! cm_InitCell(newFile, stats/4); afsi_log("Initializing ACL Data"); cm_InitACLCache(newFile, 2*stats); --- 657,666 ---- RpcStringFree(&p); afsi_log("Initializing Volume Data"); ! cm_InitVolume(newFile, maxVols); afsi_log("Initializing Cell Data"); ! cm_InitCell(newFile, maxCells); afsi_log("Initializing ACL Data"); cm_InitACLCache(newFile, 2*stats); Index: openafs/src/WINNT/afsd/cm_vnodeops.c diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.15 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.16 *** openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.15 Sat Apr 2 03:35:49 2005 --- openafs/src/WINNT/afsd/cm_vnodeops.c Tue Apr 19 01:11:17 2005 *************** *** 2692,2698 **** void **lockpp) { long code; ! int Which = ((LockType & 0x1) ? LockRead : LockWrite); AFSFid tfid; AFSVolSync volSync; cm_conn_t *connp; --- 2692,2698 ---- void **lockpp) { long code; ! int Which = ((LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite); AFSFid tfid; AFSVolSync volSync; cm_conn_t *connp; *************** *** 2706,2718 **** */ q = scp->fileLocks; while (q) { ! fileLock = (cm_file_lock_t *) ! ((char *) q - offsetof(cm_file_lock_t, fileq)); ! if ((fileLock->flags & ! (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING)) ! == 0) { ! if ((LockType & 0x1) == 0 ! || (fileLock->LockType & 0x1) == 0) return CM_ERROR_WOULDBLOCK; found = 1; } --- 2706,2715 ---- */ q = scp->fileLocks; while (q) { ! fileLock = (cm_file_lock_t *)((char *) q - offsetof(cm_file_lock_t, fileq)); ! if ((fileLock->flags & (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING)) == 0) { ! if ((LockType & LOCKING_ANDX_SHARED_LOCK) == 0 || ! (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0) return CM_ERROR_WOULDBLOCK; found = 1; } *************** *** 2766,2772 **** cm_user_t *userp, cm_req_t *reqp) { long code = 0; ! int Which = ((LockType & 0x1) ? LockRead : LockWrite); AFSFid tfid; AFSVolSync volSync; cm_conn_t *connp; --- 2763,2769 ---- cm_user_t *userp, cm_req_t *reqp) { long code = 0; ! int Which = ((LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite); AFSFid tfid; AFSVolSync volSync; cm_conn_t *connp; *************** *** 2795,2801 **** ourLock = fileLock; qq = q; } ! else if (fileLock->LockType & 0x1) anotherReader = 1; q = osi_QNext(q); } --- 2792,2798 ---- ourLock = fileLock; qq = q; } ! else if (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK) anotherReader = 1; q = osi_QNext(q); } *************** *** 2907,2913 **** long cm_RetryLock(cm_file_lock_t *oldFileLock, int vcp_is_dead) { long code; ! int Which = ((oldFileLock->LockType & 0x1) ? LockRead : LockWrite); cm_scache_t *scp; AFSFid tfid; AFSVolSync volSync; --- 2904,2910 ---- long cm_RetryLock(cm_file_lock_t *oldFileLock, int vcp_is_dead) { long code; ! int Which = ((oldFileLock->LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite); cm_scache_t *scp; AFSFid tfid; AFSVolSync volSync; *************** *** 2939,2946 **** if ((fileLock->flags & (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING)) == 0) { ! if ((oldFileLock->LockType & 0x1) == 0 ! || (fileLock->LockType & 0x1) == 0) { cm_ReleaseSCache(scp); return CM_ERROR_WOULDBLOCK; } --- 2936,2943 ---- if ((fileLock->flags & (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING)) == 0) { ! if ((oldFileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0 ! || (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0) { cm_ReleaseSCache(scp); return CM_ERROR_WOULDBLOCK; } Index: openafs/src/WINNT/afsd/smb.c diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.20 openafs/src/WINNT/afsd/smb.c:1.55.2.22 *** openafs/src/WINNT/afsd/smb.c:1.55.2.20 Thu Mar 31 18:36:42 2005 --- openafs/src/WINNT/afsd/smb.c Tue Apr 19 02:27:57 2005 *************** *** 25,30 **** --- 25,32 ---- #include #include + #include + #include #include "afsd.h" #include *************** *** 152,158 **** static showErrors = 1; /* MessageBox or something like it */ int (_stdcall *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL; - extern HANDLE WaitToTerminate; #endif /* DJGPP */ /* GMT time info: --- 154,159 ---- *************** *** 6956,6961 **** --- 6957,6964 ---- dos_ptr dos_ncb; #endif /* DJGPP */ + rx_StartClientThread(); + outncbp = GetNCB(); outbufp = GetPacket(); outbufp->ncbp = outncbp; Index: openafs/src/WINNT/afsd/smb.h diff -c openafs/src/WINNT/afsd/smb.h:1.14.2.11 openafs/src/WINNT/afsd/smb.h:1.14.2.12 *** openafs/src/WINNT/afsd/smb.h:1.14.2.11 Thu Mar 31 18:36:43 2005 --- openafs/src/WINNT/afsd/smb.h Tue Apr 19 01:11:18 2005 *************** *** 365,370 **** --- 365,376 ---- #define SMB_ATTR_NOT_CONTENT_INDEXED 0x2000 #define SMB_ATTR_ENCRYPTED 0x4000 + #define LOCKING_ANDX_SHARED_LOCK 0x01 /* Read-only lock */ + #define LOCKING_ANDX_OPLOCK_RELEASE 0x02 /* Oplock break notification */ + #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 /* Change lock type */ + #define LOCKING_ANDX_CANCEL_LOCK 0x08 /* Cancel outstanding request */ + #define LOCKING_ANDX_LARGE_FILES 0x10 /* Large file locking format */ + /* for tracking in-progress directory searches */ typedef struct smb_dirSearch { osi_queue_t q; /* queue of all outstanding cookies */ Index: openafs/src/WINNT/afsd/smb3.c diff -c openafs/src/WINNT/afsd/smb3.c:1.42.2.24 openafs/src/WINNT/afsd/smb3.c:1.42.2.25 *** openafs/src/WINNT/afsd/smb3.c:1.42.2.24 Thu Mar 31 18:36:43 2005 --- openafs/src/WINNT/afsd/smb3.c Tue Apr 19 01:11:18 2005 *************** *** 4832,4838 **** op = smb_GetSMBData(inp, NULL); for (i=0; i sizeof(wdir)) ! return FALSE; ! /* add trailing backslash, if required */ ! tlen = strlen(wdir); ! if (wdir[tlen - 1] != '\\') ! strcat(wdir, "\\"); ! strcat(wdir, file); ! fp = fopen(wdir, rwp); ! return fp; ! } CString StripPath(CString& strPath) { ! int nIndex = strPath.ReverseFind('\\'); ! CString strFile = strPath.Mid(nIndex + 1); ! if (strFile.IsEmpty()) ! return strPath; ! return strFile; } CStringArray& StripPath(CStringArray& files) { ! for (int i = 0; i < files.GetSize(); i++) ! files[i] = StripPath(files[i]); ! return files; } void Flush(const CStringArray& files) --- 69,112 ---- FILE *OpenFile(char *file, char *rwp) { ! char wdir[256]; ! long code; ! long tlen; ! FILE *fp; ! code = GetWindowsDirectory(wdir, sizeof(wdir)); ! if (code == 0 || code > sizeof(wdir)) ! return FALSE; ! /* add trailing backslash, if required */ ! tlen = strlen(wdir); ! if (wdir[tlen - 1] != '\\') ! strcat(wdir, "\\"); ! strcat(wdir, file); ! fp = fopen(wdir, rwp); ! return fp; ! } CString StripPath(CString& strPath) { ! int nIndex = strPath.ReverseFind('\\'); ! CString strFile = strPath.Mid(nIndex + 1); ! if (strFile.IsEmpty()) ! return strPath; ! return strFile; } CStringArray& StripPath(CStringArray& files) { ! for (int i = 0; i < files.GetSize(); i++) ! files[i] = StripPath(files[i]); ! return files; } void Flush(const CStringArray& files) *************** *** 115,160 **** struct ViceIoctl blob; int error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = blob.out_size = 0; ! code = pioctl(PCCHAR(files[i]), VIOCFLUSH, &blob, 0); ! if (code) { ! error = 1; ! if (errno == EMFILE) ! ShowMessageBox(IDS_FLUSH_FAILED, MB_ICONEXCLAMATION, IDS_FLUSH_FAILED, files[i]); ! else ! ShowMessageBox(IDS_FLUSH_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_ERROR, files[i], strerror(errno)); ! } ! } ! if (!error) ! ShowMessageBox(IDS_FLUSH_OK, MB_ICONEXCLAMATION, IDS_FLUSH_OK); ! } void FlushVolume(const CStringArray& files) { register LONG code; struct ViceIoctl blob; ! int error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = blob.out_size = 0; ! code = pioctl(PCCHAR(files[i]), VIOC_FLUSHVOLUME, &blob, 0); ! if (code) { ! error = 1; ! ShowMessageBox(IDS_FLUSH_VOLUME_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_ERROR, files[i], strerror(errno)); ! } ! } ! if (!code) ! ShowMessageBox(IDS_FLUSH_VOLUME_OK, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_OK); ! } void WhichCell(CStringArray& files) { --- 115,160 ---- struct ViceIoctl blob; int error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = blob.out_size = 0; ! code = pioctl(PCCHAR(files[i]), VIOCFLUSH, &blob, 0); ! if (code) { ! error = 1; ! if (errno == EMFILE) ! ShowMessageBox(IDS_FLUSH_FAILED, MB_ICONEXCLAMATION, IDS_FLUSH_FAILED, files[i]); ! else ! ShowMessageBox(IDS_FLUSH_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_ERROR, files[i], strerror(errno)); ! } ! } ! if (!error) ! ShowMessageBox(IDS_FLUSH_OK, MB_ICONEXCLAMATION, IDS_FLUSH_OK); ! } void FlushVolume(const CStringArray& files) { register LONG code; struct ViceIoctl blob; ! int error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = blob.out_size = 0; ! code = pioctl(PCCHAR(files[i]), VIOC_FLUSHVOLUME, &blob, 0); ! if (code) { ! error = 1; ! ShowMessageBox(IDS_FLUSH_VOLUME_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_ERROR, files[i], strerror(errno)); ! } ! } ! if (!code) ! ShowMessageBox(IDS_FLUSH_VOLUME_OK, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_OK); ! } void WhichCell(CStringArray& files) { *************** *** 164,196 **** CString str; CString str2; ! CStringArray results; error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = 0; ! blob.out_size = MAXSIZE; ! blob.out = space; ! ! code = pioctl(PCCHAR(files[i]), VIOC_FILE_CELL_NAME, &blob, 1); ! if (code) { ! if (code == ENOENT) { ! LoadString (str, IDS_CANT_GET_CELL); ! results.Add(str); ! } else ! results.Add(GetAfsError(errno)); ! } else ! results.Add(space); ! } ! ! LoadString (str, IDS_SHOW_CELL); ! LoadString (str2, IDS_SHOW_CELL_COLUMN); ! CResultsDlg dlg(SHOW_CELL_HELP_ID); ! dlg.SetContents(str, str2, StripPath(files), results); ! dlg.DoModal(); } void WSCellCmd() --- 164,196 ---- CString str; CString str2; ! CStringArray results; error = 0; ! HOURGLASS hourglass; ! for (int i = 0; i < files.GetSize(); i++) { ! blob.in_size = 0; ! blob.out_size = MAXSIZE; ! blob.out = space; ! ! code = pioctl(PCCHAR(files[i]), VIOC_FILE_CELL_NAME, &blob, 1); ! if (code) { ! if (code == ENOENT) { ! LoadString (str, IDS_CANT_GET_CELL); ! results.Add(str); ! } else ! results.Add(GetAfsError(errno)); ! } else ! results.Add(space); ! } ! ! LoadString (str, IDS_SHOW_CELL); ! LoadString (str2, IDS_SHOW_CELL_COLUMN); ! CResultsDlg dlg(SHOW_CELL_HELP_ID); ! dlg.SetContents(str, str2, StripPath(files), results); ! dlg.DoModal(); } void WSCellCmd() *************** *** 198,204 **** register LONG code; struct ViceIoctl blob; ! HOURGLASS hourglass; blob.in_size = 0; blob.in = (char *) 0; --- 198,204 ---- register LONG code; struct ViceIoctl blob; ! HOURGLASS hourglass; blob.in_size = 0; blob.in = (char *) 0; *************** *** 208,217 **** code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1); if (code) { ! //Die(errno, (char *) 0); } //else ! //printf("This workstation belongs to cell '%s'\n", space); } BOOL CheckVolumes() --- 208,217 ---- code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1); if (code) { ! //Die(errno, (char *) 0); } //else ! //printf("This workstation belongs to cell '%s'\n", space); } BOOL CheckVolumes() *************** *** 223,235 **** blob.out_size = 0; code = pioctl(0, VIOCCKBACK, &blob, 1); if (code) { ! ShowMessageBox(IDS_CHECK_VOLUMES_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_VOLUMES_ERROR, GetAfsError(errno, CString())); ! return FALSE; } ShowMessageBox(IDS_CHECK_VOLUMES_OK, MB_OK, IDS_CHECK_VOLUMES_OK); ! return TRUE; } void SetCacheSizeCmd(LONG nNewCacheSize) --- 223,235 ---- blob.out_size = 0; code = pioctl(0, VIOCCKBACK, &blob, 1); if (code) { ! ShowMessageBox(IDS_CHECK_VOLUMES_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_VOLUMES_ERROR, GetAfsError(errno, CString())); ! return FALSE; } ShowMessageBox(IDS_CHECK_VOLUMES_OK, MB_OK, IDS_CHECK_VOLUMES_OK); ! return TRUE; } void SetCacheSizeCmd(LONG nNewCacheSize) *************** *** 237,334 **** register LONG code; struct ViceIoctl blob; ! HOURGLASS hourglass; ! blob.in = (char *) &nNewCacheSize; blob.in_size = sizeof(LONG); blob.out_size = 0; code = pioctl(0, VIOCSETCACHESIZE, &blob, 1); //if (code) ! // Die(errno, (char *) 0); //else ! // printf("New cache size set.\n"); } void WhereIs(CStringArray& files) { register LONG code; struct ViceIoctl blob; ! CStringArray servers; ! CStringArray resultFiles; ! CString str; ! CString str2; ! ! HOURGLASS hourglass; ! ! for (int i = 0; i < files.GetSize(); i++) { ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! memset(space, 0, sizeof(space)); ! ! code = pioctl(PCCHAR(files[i]), VIOCWHEREIS, &blob, 1); ! if (code) { ! resultFiles.Add(StripPath(files[i])); ! servers.Add(GetAfsError(errno)); ! continue; ! } ! ! LONG *hosts = (LONG *)space; ! BOOL bFirst = TRUE; ! str = ""; ! ! for (int j = 0; j < MAXHOSTS; j++) { ! if (hosts[j] == 0) ! break; ! char *hostName = hostutil_GetNameByINet(hosts[j]); ! if (bFirst) { ! resultFiles.Add(StripPath(files[i])); ! bFirst = FALSE; ! } else ! resultFiles.Add(" "); ! servers.Add(hostName); ! } ! } ! ! LoadString (str, IDS_SHOW_FS); ! LoadString (str2, IDS_SHOW_FS_COLUMN); ! CResultsDlg dlg(SHOW_FILE_SERVERS_HELP_ID); ! dlg.SetContents(str, str2, resultFiles, servers); ! dlg.DoModal(); ! } CString GetAfsError(int code, const char *filename) { CString strMsg; ! if (code == EINVAL) { ! if (filename) ! strMsg.Format("Invalid argument; it is possible that the file is not in AFS"); ! else ! strMsg.Format("Invalid argument"); } else if (code == ENOENT) { ! if (filename) ! strMsg.Format("The file does not exist"); ! else ! strMsg.Format("No such file returned"); } else if (code == EROFS) { ! strMsg.Format("You can not change a backup or readonly volume"); } else if (code == EACCES || code == EPERM) { ! strMsg.Format("You do not have the required rights to do this operation"); } else if (code == ENODEV) { ! strMsg.Format("AFS service may not have started"); } else if (code == ESRCH) { ! strMsg.Format("Cell name not recognized"); } else if (code == ETIMEDOUT) { ! strMsg.Format("Connection timed out"); } else if (code == EPIPE) { ! strMsg.Format("Volume name or ID not recognized"); } else { ! strMsg.Format("Error 0x%x occurred", code); } ! return strMsg; } --- 237,334 ---- register LONG code; struct ViceIoctl blob; ! HOURGLASS hourglass; ! blob.in = (char *) &nNewCacheSize; blob.in_size = sizeof(LONG); blob.out_size = 0; code = pioctl(0, VIOCSETCACHESIZE, &blob, 1); //if (code) ! // Die(errno, (char *) 0); //else ! // printf("New cache size set.\n"); } void WhereIs(CStringArray& files) { register LONG code; struct ViceIoctl blob; ! CStringArray servers; ! CStringArray resultFiles; ! CString str; ! CString str2; ! ! HOURGLASS hourglass; ! ! for (int i = 0; i < files.GetSize(); i++) { ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! memset(space, 0, sizeof(space)); ! ! code = pioctl(PCCHAR(files[i]), VIOCWHEREIS, &blob, 1); ! if (code) { ! resultFiles.Add(StripPath(files[i])); ! servers.Add(GetAfsError(errno)); ! continue; ! } ! ! LONG *hosts = (LONG *)space; ! BOOL bFirst = TRUE; ! str = ""; ! ! for (int j = 0; j < MAXHOSTS; j++) { ! if (hosts[j] == 0) ! break; ! char *hostName = hostutil_GetNameByINet(hosts[j]); ! if (bFirst) { ! resultFiles.Add(StripPath(files[i])); ! bFirst = FALSE; ! } else ! resultFiles.Add(" "); ! servers.Add(hostName); ! } ! } ! ! LoadString (str, IDS_SHOW_FS); ! LoadString (str2, IDS_SHOW_FS_COLUMN); ! CResultsDlg dlg(SHOW_FILE_SERVERS_HELP_ID); ! dlg.SetContents(str, str2, resultFiles, servers); ! dlg.DoModal(); ! } CString GetAfsError(int code, const char *filename) { CString strMsg; ! if (code == EINVAL) { ! if (filename) ! strMsg.Format("Invalid argument; it is possible that the file is not in AFS"); ! else ! strMsg.Format("Invalid argument"); } else if (code == ENOENT) { ! if (filename) ! strMsg.Format("The file does not exist"); ! else ! strMsg.Format("No such file returned"); } else if (code == EROFS) { ! strMsg.Format("You can not change a backup or readonly volume"); } else if (code == EACCES || code == EPERM) { ! strMsg.Format("You do not have the required rights to do this operation"); } else if (code == ENODEV) { ! strMsg.Format("AFS service may not have started"); } else if (code == ESRCH) { ! strMsg.Format("Cell name not recognized"); } else if (code == ETIMEDOUT) { ! strMsg.Format("Connection timed out"); } else if (code == EPIPE) { ! strMsg.Format("Volume name or ID not recognized"); } else { ! strMsg.Format("Error 0x%x occurred", code); } ! return strMsg; } *************** *** 345,353 **** }; struct Acl { ! int dfs; // Originally true if a dfs acl; now also the type ! // of the acl (1, 2, or 3, corresponding to object, ! // initial dir, or initial object). sec_rgy_name_t cell; // DFS cell name int nplus; int nminus; --- 345,353 ---- }; struct Acl { ! int dfs; // Originally true if a dfs acl; now also the type ! // of the acl (1, 2, or 3, corresponding to object, ! // initial dir, or initial object). sec_rgy_name_t cell; // DFS cell name int nplus; int nminus; *************** *** 391,420 **** struct AclEntry *te, *ne; LONG ctr = 0; ! for (te = *ae; te; te = ne) { if ((!dfs && te->rights == 0) || te->rights == -1) { *lp = te->next; ne = te->next; free(te); ctr++; ! } else { ne = te->next; lp = &te->next; ! } } ! return ctr; } char *SkipLine (register char *astr) { while (*astr != '\n') ! astr++; ! astr++; ! return astr; } /* tell if a name is 23 or -45 (digits or minus digits), which are bad names we must prune */ --- 391,420 ---- struct AclEntry *te, *ne; LONG ctr = 0; ! for (te = *ae; te; te = ne) { if ((!dfs && te->rights == 0) || te->rights == -1) { *lp = te->next; ne = te->next; free(te); ctr++; ! } else { ne = te->next; lp = &te->next; ! } } ! return ctr; } char *SkipLine (register char *astr) { while (*astr != '\n') ! astr++; ! astr++; ! return astr; } /* tell if a name is 23 or -45 (digits or minus digits), which are bad names we must prune */ *************** *** 422,431 **** { register int tc; ! /* all must be '-' or digit to be bad */ while (tc = *aname++) { ! if ((tc != '-') && (tc < '0' || tc > '9')) ! return 0; } return 1; --- 422,431 ---- { register int tc; ! /* all must be '-' or digit to be bad */ while (tc = *aname++) { ! if ((tc != '-') && (tc < '0' || tc > '9')) ! return 0; } return 1; *************** *** 433,450 **** CString GetRightsString(register LONG arights, int dfs) { ! CString str; if (!dfs) { ! if (arights & PRSFS_READ) str += "r"; ! if (arights & PRSFS_LOOKUP) str += "l"; ! if (arights & PRSFS_INSERT) str += "i"; ! if (arights & PRSFS_DELETE) str += "d"; ! if (arights & PRSFS_WRITE) str += "w"; ! if (arights & PRSFS_LOCK) str += "k"; ! if (arights & PRSFS_ADMINISTER) str += "a"; } else { ! ASSERT(FALSE); /* if (arights & DFS_READ) str += "r"; else str += "-"; if (arights & DFS_WRITE) str += "w"; else printf("-"); --- 433,450 ---- CString GetRightsString(register LONG arights, int dfs) { ! CString str; if (!dfs) { ! if (arights & PRSFS_READ) str += "r"; ! if (arights & PRSFS_LOOKUP) str += "l"; ! if (arights & PRSFS_INSERT) str += "i"; ! if (arights & PRSFS_DELETE) str += "d"; ! if (arights & PRSFS_WRITE) str += "w"; ! if (arights & PRSFS_LOCK) str += "k"; ! if (arights & PRSFS_ADMINISTER) str += "a"; } else { ! ASSERT(FALSE); /* if (arights & DFS_READ) str += "r"; else str += "-"; if (arights & DFS_WRITE) str += "w"; else printf("-"); *************** *** 454,462 **** if (arights & DFS_DELETE) str += "d"; else printf("-"); if (arights & (DFS_USRALL)) str += "+"; */ ! } ! return str; } char *AclToString(struct Acl *acl) --- 454,462 ---- if (arights & DFS_DELETE) str += "d"; else printf("-"); if (arights & (DFS_USRALL)) str += "+"; */ ! } ! return str; } char *AclToString(struct Acl *acl) *************** *** 467,488 **** struct AclEntry *tp; if (acl->dfs) ! sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell); else ! dfsstring[0] = '\0'; sprintf(mydata, "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus); ! for(tp = acl->pluslist; tp; tp = tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } ! for(tp = acl->minuslist; tp; tp = tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } ! return mydata; } struct Acl *EmptyAcl(const CString& strCellName) --- 467,488 ---- struct AclEntry *tp; if (acl->dfs) ! sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell); else ! dfsstring[0] = '\0'; sprintf(mydata, "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus); ! for(tp = acl->pluslist; tp; tp = tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } ! for(tp = acl->minuslist; tp; tp = tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } ! return mydata; } struct Acl *EmptyAcl(const CString& strCellName) *************** *** 559,600 **** register struct AclEntry *te, **le, *ne; int changes; ! HOURGLASS hourglass; /* Don't correct DFS ACL's for now */ if (aa->dfs) ! return 0; /* prune out bad entries */ changes = 0; /* count deleted entries */ le = &aa->pluslist; for(te = aa->pluslist; te; te = ne) { ! ne = te->next; ! if (BadName(te->name)) { ! /* zap this dude */ ! *le = te->next; ! aa->nplus--; ! free(te); ! changes++; ! } ! else ! le = &te->next; } le = &aa->minuslist; ! for(te = aa->minuslist; te; te = ne) { ! ne = te->next; ! if (BadName(te->name)) { ! /* zap this dude */ ! *le = te->next; ! aa->nminus--; ! free(te); ! changes++; ! } ! else ! le = &te->next; ! } return changes; } --- 559,600 ---- register struct AclEntry *te, **le, *ne; int changes; ! HOURGLASS hourglass; /* Don't correct DFS ACL's for now */ if (aa->dfs) ! return 0; /* prune out bad entries */ changes = 0; /* count deleted entries */ le = &aa->pluslist; for(te = aa->pluslist; te; te = ne) { ! ne = te->next; ! if (BadName(te->name)) { ! /* zap this dude */ ! *le = te->next; ! aa->nplus--; ! free(te); ! changes++; ! } ! else ! le = &te->next; } le = &aa->minuslist; ! for(te = aa->minuslist; te; te = ne) { ! ne = te->next; ! if (BadName(te->name)) { ! /* zap this dude */ ! *le = te->next; ! aa->nminus--; ! free(te); ! changes++; ! } ! else ! le = &te->next; ! } return changes; } *************** *** 606,654 **** struct ViceIoctl blob; int changes; ! ShowMessageBox(IDS_CLEANACL_MSG, MB_OK, IDS_CLEANACL_MSG); ! HOURGLASS hourglass; ! for (int i = 0; i < names.GetSize(); i++) { ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! ! code = pioctl(PCCHAR(names[i]), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno)); ! continue; ! } ! ! ta = ParseAcl(space); ! if (ta->dfs) { ! ShowMessageBox(IDS_CLEANACL_NOT_SUPPORTED, MB_ICONEXCLAMATION, IDS_CLEANACL_NOT_SUPPORTED, names[i]); ! continue; ! } ! ! changes = CleanAcl(ta); ! if (!changes) ! continue; ! ! /* now set the acl */ ! blob.in = AclToString(ta); ! blob.in_size = strlen((char *)blob.in) + 1; ! blob.out_size = 0; ! code = pioctl(PCCHAR(names[i]), VIOCSETAL, &blob, 1); ! if (code) { ! if (errno == EINVAL) { ! ShowMessageBox(IDS_CLEANACL_INVALID_ARG, MB_ICONEXCLAMATION, IDS_CLEANACL_INVALID_ARG, names[i]); ! continue; ! } ! else { ! ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno)); ! continue; ! } ! } ! } ! } // Derived from fs.c's ListAclCmd BOOL GetRights(const CString& strDir, CStringArray& strNormal, CStringArray& strNegative) --- 606,654 ---- struct ViceIoctl blob; int changes; ! ShowMessageBox(IDS_CLEANACL_MSG, MB_OK, IDS_CLEANACL_MSG); ! HOURGLASS hourglass; ! for (int i = 0; i < names.GetSize(); i++) { ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! ! code = pioctl(PCCHAR(names[i]), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno)); ! continue; ! } ! ! ta = ParseAcl(space); ! if (ta->dfs) { ! ShowMessageBox(IDS_CLEANACL_NOT_SUPPORTED, MB_ICONEXCLAMATION, IDS_CLEANACL_NOT_SUPPORTED, names[i]); ! continue; ! } ! ! changes = CleanAcl(ta); ! if (!changes) ! continue; ! ! /* now set the acl */ ! blob.in = AclToString(ta); ! blob.in_size = strlen((char *)blob.in) + 1; ! blob.out_size = 0; ! code = pioctl(PCCHAR(names[i]), VIOCSETAL, &blob, 1); ! if (code) { ! if (errno == EINVAL) { ! ShowMessageBox(IDS_CLEANACL_INVALID_ARG, MB_ICONEXCLAMATION, IDS_CLEANACL_INVALID_ARG, names[i]); ! continue; ! } ! else { ! ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno)); ! continue; ! } ! } ! } ! } // Derived from fs.c's ListAclCmd BOOL GetRights(const CString& strDir, CStringArray& strNormal, CStringArray& strNegative) *************** *** 659,728 **** struct AclEntry *te; int idf = 0; //getidf(as, parm_listacl_id); ! HOURGLASS hourglass; ! blob.out_size = MAXSIZE; ! blob.in_size = idf; ! blob.in = blob.out = space; ! code = pioctl(PCCHAR(strDir), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_GETRIGHTS_ERROR, MB_ICONEXCLAMATION, IDS_GETRIGHTS_ERROR, strDir, GetAfsError(errno)); ! return FALSE; ! } ! ! ta = ParseAcl(space); ! if (ta->dfs) { ! ShowMessageBox(IDS_DFSACL_ERROR, MB_ICONEXCLAMATION, IDS_DFSACL_ERROR); ! return FALSE; ! } // if (ta->dfs) // printf(" Default cell = %s\n", ta->cell); ! CString strRight; ! if (ta->nplus > 0) { ! for (te = ta->pluslist; te; te = te->next) { ! strNormal.Add(te->name); ! strNormal.Add(GetRightsString(te->rights, ta->dfs)); ! } ! } ! ! if (ta->nminus > 0) { ! for (te = ta->minuslist; te; te = te->next) { ! strNegative.Add(te->name); ! strNegative.Add(GetRightsString(te->rights, ta->dfs)); ! } ! } ! return TRUE; } struct AclEntry *FindList(register struct AclEntry *pCurEntry, const char *entryName) { while (pCurEntry) { if (!foldcmp(pCurEntry->name, PCCHAR(entryName))) ! return pCurEntry; ! pCurEntry = pCurEntry->next; } ! return 0; } void ChangeList (struct Acl *pAcl, BYTE bNormalRights, const char *entryName, LONG nEntryRights) { ! ASSERT(pAcl); ! ASSERT(entryName); ! struct AclEntry *pEntry; ! HOURGLASS hourglass; pEntry = (bNormalRights ? pAcl->pluslist : pAcl->minuslist); pEntry = FindList(pEntry, entryName); ! /* Found the item already in the list. */ if (pEntry) { pEntry->rights = nEntryRights; if (bNormalRights) --- 659,728 ---- struct AclEntry *te; int idf = 0; //getidf(as, parm_listacl_id); ! HOURGLASS hourglass; ! blob.out_size = MAXSIZE; ! blob.in_size = idf; ! blob.in = blob.out = space; ! code = pioctl(PCCHAR(strDir), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_GETRIGHTS_ERROR, MB_ICONEXCLAMATION, IDS_GETRIGHTS_ERROR, strDir, GetAfsError(errno)); ! return FALSE; ! } ! ! ta = ParseAcl(space); ! if (ta->dfs) { ! ShowMessageBox(IDS_DFSACL_ERROR, MB_ICONEXCLAMATION, IDS_DFSACL_ERROR); ! return FALSE; ! } // if (ta->dfs) // printf(" Default cell = %s\n", ta->cell); ! CString strRight; ! if (ta->nplus > 0) { ! for (te = ta->pluslist; te; te = te->next) { ! strNormal.Add(te->name); ! strNormal.Add(GetRightsString(te->rights, ta->dfs)); ! } ! } ! if (ta->nminus > 0) { ! for (te = ta->minuslist; te; te = te->next) { ! strNegative.Add(te->name); ! strNegative.Add(GetRightsString(te->rights, ta->dfs)); ! } ! } ! ! return TRUE; } struct AclEntry *FindList(register struct AclEntry *pCurEntry, const char *entryName) { while (pCurEntry) { if (!foldcmp(pCurEntry->name, PCCHAR(entryName))) ! return pCurEntry; ! pCurEntry = pCurEntry->next; } ! return 0; } void ChangeList (struct Acl *pAcl, BYTE bNormalRights, const char *entryName, LONG nEntryRights) { ! ASSERT(pAcl); ! ASSERT(entryName); ! struct AclEntry *pEntry; ! HOURGLASS hourglass; pEntry = (bNormalRights ? pAcl->pluslist : pAcl->minuslist); pEntry = FindList(pEntry, entryName); ! /* Found the item already in the list. */ if (pEntry) { pEntry->rights = nEntryRights; if (bNormalRights) *************** *** 736,757 **** pEntry = (struct AclEntry *) malloc(sizeof (struct AclEntry)); ASSERT(pEntry); ! strcpy(pEntry->name, entryName); pEntry->rights = nEntryRights; ! if (bNormalRights) { pEntry->next = pAcl->pluslist; pAcl->pluslist = pEntry; pAcl->nplus++; if (nEntryRights == 0 || nEntryRights == -1) ! pAcl->nplus -= PruneList(&pAcl->pluslist, pAcl->dfs); } else { pEntry->next = pAcl->minuslist; pAcl->minuslist = pEntry; pAcl->nminus++; if (nEntryRights == 0) ! pAcl->nminus -= PruneList(&pAcl->minuslist, pAcl->dfs); } } --- 736,757 ---- pEntry = (struct AclEntry *) malloc(sizeof (struct AclEntry)); ASSERT(pEntry); ! strcpy(pEntry->name, entryName); pEntry->rights = nEntryRights; ! if (bNormalRights) { pEntry->next = pAcl->pluslist; pAcl->pluslist = pEntry; pAcl->nplus++; if (nEntryRights == 0 || nEntryRights == -1) ! pAcl->nplus -= PruneList(&pAcl->pluslist, pAcl->dfs); } else { pEntry->next = pAcl->minuslist; pAcl->minuslist = pEntry; pAcl->nminus++; if (nEntryRights == 0) ! pAcl->nminus -= PruneList(&pAcl->minuslist, pAcl->dfs); } } *************** *** 765,782 **** *rtypep = add; /* add rights, by default */ ! if (!strcmp(arights,"read")) ! return PRSFS_READ | PRSFS_LOOKUP; ! if (!strcmp(arights, "write")) ! return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK; ! if (!strcmp(arights, "mail")) ! return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP; ! if (!strcmp(arights, "all")) ! return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER; ! ! if (!strcmp(arights, "none")) { ! *rtypep = destroy; /* Remove entire entry */ ! return 0; } len = strlen(arights); --- 765,782 ---- *rtypep = add; /* add rights, by default */ ! if (!strcmp(arights,"read")) ! return PRSFS_READ | PRSFS_LOOKUP; ! if (!strcmp(arights, "write")) ! return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK; ! if (!strcmp(arights, "mail")) ! return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP; ! if (!strcmp(arights, "all")) ! return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER; ! ! if (!strcmp(arights, "none")) { ! *rtypep = destroy; /* Remove entire entry */ ! return 0; } len = strlen(arights); *************** *** 784,801 **** for (i = 0; i < len; i++) { tc = *arights++; ! if (tc == 'r') mode |= PRSFS_READ; ! else if (tc == 'l') mode |= PRSFS_LOOKUP; ! else if (tc == 'i') mode |= PRSFS_INSERT; ! else if (tc == 'd') mode |= PRSFS_DELETE; ! else if (tc == 'w') mode |= PRSFS_WRITE; ! else if (tc == 'k') mode |= PRSFS_LOCK; ! else if (tc == 'a') mode |= PRSFS_ADMINISTER; ! else { ! fprintf(stderr, "illegal rights character '%c'.\n", tc); ! exit(1); ! } ! } return mode; } --- 784,801 ---- for (i = 0; i < len; i++) { tc = *arights++; ! if (tc == 'r') mode |= PRSFS_READ; ! else if (tc == 'l') mode |= PRSFS_LOOKUP; ! else if (tc == 'i') mode |= PRSFS_INSERT; ! else if (tc == 'd') mode |= PRSFS_DELETE; ! else if (tc == 'w') mode |= PRSFS_WRITE; ! else if (tc == 'k') mode |= PRSFS_LOCK; ! else if (tc == 'a') mode |= PRSFS_ADMINISTER; ! else { ! fprintf(stderr, "illegal rights character '%c'.\n", tc); ! exit(1); ! } ! } return mode; } *************** *** 805,843 **** struct ViceIoctl blob; struct Acl *pAcl; LONG rights; ! enum rtype rtype; ! HOURGLASS hourglass; ! // Create a new ACL ! pAcl = EmptyAcl(strCellName); ! // Set its normal rights ! for (int i = 0; i < normal.GetSize(); i += 2) { ! rights = Convert(normal[i + 1], 0, &rtype); ! ChangeList(pAcl, TRUE, normal[i], rights); ! } ! ! // Set its negative rights ! for (i = 0; i < negative.GetSize(); i += 2) { ! rights = Convert(negative[i + 1], 0, &rtype); ! ChangeList(pAcl, FALSE, negative[i], rights); ! } ! ! // Write the ACL ! blob.in = AclToString(pAcl); ! blob.out_size = 0; ! blob.in_size = 1 + strlen((const char *)blob.in); ! ! code = pioctl(PCCHAR(strDir), VIOCSETAL, &blob, 1); ! if (code) { ! if (errno == EINVAL) ! ShowMessageBox(IDS_SAVE_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_EINVAL_ERROR, strDir); ! else ! ShowMessageBox(IDS_SAVE_ACL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_ERROR, strDir, GetAfsError(errno, strDir)); ! } ! ZapAcl(pAcl); return (code == 0); } --- 805,843 ---- struct ViceIoctl blob; struct Acl *pAcl; LONG rights; ! enum rtype rtype; ! HOURGLASS hourglass; ! // Create a new ACL ! pAcl = EmptyAcl(strCellName); ! // Set its normal rights ! for (int i = 0; i < normal.GetSize(); i += 2) { ! rights = Convert(normal[i + 1], 0, &rtype); ! ChangeList(pAcl, TRUE, normal[i], rights); ! } ! ! // Set its negative rights ! for (i = 0; i < negative.GetSize(); i += 2) { ! rights = Convert(negative[i + 1], 0, &rtype); ! ChangeList(pAcl, FALSE, negative[i], rights); ! } ! // Write the ACL ! blob.in = AclToString(pAcl); ! blob.out_size = 0; ! blob.in_size = 1 + strlen((const char *)blob.in); ! ! code = pioctl(PCCHAR(strDir), VIOCSETAL, &blob, 1); ! if (code) { ! if (errno == EINVAL) ! ShowMessageBox(IDS_SAVE_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_EINVAL_ERROR, strDir); ! else ! ShowMessageBox(IDS_SAVE_ACL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_ERROR, strDir, GetAfsError(errno, strDir)); ! } ! ! ZapAcl(pAcl); return (code == 0); } *************** *** 849,939 **** struct Acl *pToAcl; int idf = 0; // getidf(as, parm_copyacl_id); ! HOURGLASS hourglass; ! // Get ACL to copy to ! blob.out_size = MAXSIZE; ! blob.in_size = idf; ! blob.in = blob.out = space; ! ! code = pioctl(PCCHAR(strToDir), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_ACL_READ_ERROR, MB_ICONEXCLAMATION, IDS_ACL_READ_ERROR, strToDir, GetAfsError(errno, strToDir)); ! return FALSE; ! } ! ! if (bClear) ! pToAcl = EmptyAcl(space); ! else ! pToAcl = ParseAcl(space); ! ! CleanAcl(pToAcl); ! if (pToAcl->dfs) { ! ShowMessageBox(IDS_NO_DFS_COPY_ACL, MB_ICONEXCLAMATION, IDS_NO_DFS_COPY_ACL, strToDir); ! ZapAcl(pToAcl); ! return FALSE; ! } ! ! enum rtype rtype; ! ! // Set normal rights ! for (int i = 0; i < normal.GetSize(); i += 2) { ! LONG rights = Convert(normal[i + 1], 0, &rtype); ! ChangeList(pToAcl, TRUE, normal[i], rights); ! } ! ! // Set negative rights ! for (i = 0; i < negative.GetSize(); i += 2) { ! LONG rights = Convert(negative[i + 1], 0, &rtype); ! ChangeList(pToAcl, FALSE, normal[i], rights); ! } ! ! // Save modified ACL ! blob.in = AclToString(pToAcl); ! blob.out_size = 0; ! blob.in_size = 1 + strlen((char *)blob.in); ! code = pioctl(PCCHAR(strToDir), VIOCSETAL, &blob, 1); ! if (code) { ! ZapAcl(pToAcl); ! if (errno == EINVAL) ! ShowMessageBox(IDS_COPY_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_EINVAL_ERROR, strToDir); ! else ! ShowMessageBox(IDS_COPY_ACL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_ERROR, strToDir, GetAfsError(errno, strToDir)); ! return FALSE; ! } ! ZapAcl(pToAcl); ! ShowMessageBox(IDS_COPY_ACL_OK, MB_OK, IDS_COPY_ACL_OK); return TRUE; } CString ParseMountPoint(const CString strFile, CString strMountPoint) { ! CString strType; ! CString strVolume; ! CString strCell; ! CString strMountPointInfo; ! ! if (strMountPoint[0] == '#') ! strType = "Regular"; ! else if (strMountPoint[0] == '%') ! strType = "Read/Write"; ! ! int nColon = strMountPoint.Find(':'); ! if (nColon >= 0) { ! strCell = strMountPoint.Mid(1, nColon - 1); ! strVolume = strMountPoint.Mid(nColon + 1); ! } else ! strVolume = strMountPoint.Mid(1); ! strMountPointInfo = strFile + "\t" + strVolume + "\t" + strCell + "\t" + strType; ! return strMountPointInfo; ! } BOOL ListMount(CStringArray& files) { --- 849,939 ---- struct Acl *pToAcl; int idf = 0; // getidf(as, parm_copyacl_id); ! HOURGLASS hourglass; ! // Get ACL to copy to ! blob.out_size = MAXSIZE; ! blob.in_size = idf; ! blob.in = blob.out = space; ! code = pioctl(PCCHAR(strToDir), VIOCGETAL, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_ACL_READ_ERROR, MB_ICONEXCLAMATION, IDS_ACL_READ_ERROR, strToDir, GetAfsError(errno, strToDir)); ! return FALSE; ! } ! if (bClear) ! pToAcl = EmptyAcl(space); ! else ! pToAcl = ParseAcl(space); ! ! CleanAcl(pToAcl); ! ! if (pToAcl->dfs) { ! ShowMessageBox(IDS_NO_DFS_COPY_ACL, MB_ICONEXCLAMATION, IDS_NO_DFS_COPY_ACL, strToDir); ! ZapAcl(pToAcl); ! return FALSE; ! } ! ! enum rtype rtype; ! ! // Set normal rights ! for (int i = 0; i < normal.GetSize(); i += 2) { ! LONG rights = Convert(normal[i + 1], 0, &rtype); ! ChangeList(pToAcl, TRUE, normal[i], rights); ! } ! ! // Set negative rights ! for (i = 0; i < negative.GetSize(); i += 2) { ! LONG rights = Convert(negative[i + 1], 0, &rtype); ! ChangeList(pToAcl, FALSE, normal[i], rights); ! } ! ! // Save modified ACL ! blob.in = AclToString(pToAcl); ! blob.out_size = 0; ! blob.in_size = 1 + strlen((char *)blob.in); ! ! code = pioctl(PCCHAR(strToDir), VIOCSETAL, &blob, 1); ! if (code) { ! ZapAcl(pToAcl); ! if (errno == EINVAL) ! ShowMessageBox(IDS_COPY_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_EINVAL_ERROR, strToDir); ! else ! ShowMessageBox(IDS_COPY_ACL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_ERROR, strToDir, GetAfsError(errno, strToDir)); ! return FALSE; ! } ! ZapAcl(pToAcl); ! ShowMessageBox(IDS_COPY_ACL_OK, MB_OK, IDS_COPY_ACL_OK); return TRUE; } CString ParseMountPoint(const CString strFile, CString strMountPoint) { ! CString strType; ! CString strVolume; ! CString strCell; ! CString strMountPointInfo; ! ! if (strMountPoint[0] == '#') ! strType = "Regular"; ! else if (strMountPoint[0] == '%') ! strType = "Read/Write"; ! ! int nColon = strMountPoint.Find(':'); ! if (nColon >= 0) { ! strCell = strMountPoint.Mid(1, nColon - 1); ! strVolume = strMountPoint.Mid(nColon + 1); ! } else ! strVolume = strMountPoint.Mid(1); ! strMountPointInfo = strFile + "\t" + strVolume + "\t" + strCell + "\t" + strType; ! return strMountPointInfo; ! } BOOL ListMount(CStringArray& files) { *************** *** 944,1009 **** char true_name[1024]; /* ``True'' dirname (e.g., symlink target) */ char parent_dir[1024]; /* Parent directory of true name */ register char *last_component; /* Last component of true name */ ! CStringArray mountPoints; ! HOURGLASS hourglass; error = 0; for (int i = 0; i < files.GetSize(); i++) { ! strcpy(orig_name, files[i]); ! strcpy(true_name, orig_name); ! /* ! * Find rightmost slash, if any. ! */ ! last_component = (char *)strrchr(true_name, '\\'); ! if (last_component) { ! /* ! * Found it. Designate everything before it as the parent directory, ! * everything after it as the final component. ! */ ! strncpy(parent_dir, true_name, last_component - true_name + 1); ! parent_dir[last_component - true_name + 1] = 0; ! last_component++; /* Skip the slash */ ! } ! else { ! /* ! * No slash appears in the given file name. Set parent_dir to the current ! * directory, and the last component as the given name. ! */ ! fs_ExtractDriveLetter(true_name, parent_dir); ! strcat(parent_dir, "."); ! last_component = true_name; ! fs_StripDriveLetter(true_name, true_name, sizeof(true_name)); ! } ! ! blob.in = last_component; ! blob.in_size = strlen(last_component) + 1; ! blob.out_size = MAXSIZE; ! blob.out = space; ! memset(space, 0, MAXSIZE); ! ! code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1); ! if (code == 0) { ! int nPos = strlen(space) - 1; ! if (space[nPos] == '.') ! space[nPos] = 0; ! mountPoints.Add(ParseMountPoint(StripPath(files[i]), space)); ! } else { ! error = 1; ! if (errno == EINVAL) ! mountPoints.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i]))); ! else ! mountPoints.Add(GetMessageString(IDS_LIST_MOUNT_POINT_ERROR, GetAfsError(errno, StripPath(files[i])))); ! } ! } ! ! CMountPointsDlg dlg; ! dlg.SetMountPoints(mountPoints); ! dlg.DoModal(); ! return !error; } BOOL IsPathInAfs(const CHAR *strPath) --- 944,1009 ---- char true_name[1024]; /* ``True'' dirname (e.g., symlink target) */ char parent_dir[1024]; /* Parent directory of true name */ register char *last_component; /* Last component of true name */ ! CStringArray mountPoints; ! HOURGLASS hourglass; error = 0; for (int i = 0; i < files.GetSize(); i++) { ! strcpy(orig_name, files[i]); ! strcpy(true_name, orig_name); ! /* ! * Find rightmost slash, if any. ! */ ! last_component = (char *)strrchr(true_name, '\\'); ! if (last_component) { ! /* ! * Found it. Designate everything before it as the parent directory, ! * everything after it as the final component. ! */ ! strncpy(parent_dir, true_name, last_component - true_name + 1); ! parent_dir[last_component - true_name + 1] = 0; ! last_component++; /* Skip the slash */ ! } ! else { ! /* ! * No slash appears in the given file name. Set parent_dir to the current ! * directory, and the last component as the given name. ! */ ! fs_ExtractDriveLetter(true_name, parent_dir); ! strcat(parent_dir, "."); ! last_component = true_name; ! fs_StripDriveLetter(true_name, true_name, sizeof(true_name)); ! } ! blob.in = last_component; ! blob.in_size = strlen(last_component) + 1; ! blob.out_size = MAXSIZE; ! blob.out = space; ! memset(space, 0, MAXSIZE); ! ! code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1); ! if (code == 0) { ! int nPos = strlen(space) - 1; ! if (space[nPos] == '.') ! space[nPos] = 0; ! mountPoints.Add(ParseMountPoint(StripPath(files[i]), space)); ! } else { ! error = 1; ! if (errno == EINVAL) ! mountPoints.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i]))); ! else ! mountPoints.Add(GetMessageString(IDS_LIST_MOUNT_POINT_ERROR, GetAfsError(errno, StripPath(files[i])))); ! } ! } ! ! CMountPointsDlg dlg; ! dlg.SetMountPoints(mountPoints); ! dlg.DoModal(); ! ! return !error; } BOOL IsPathInAfs(const CHAR *strPath) *************** *** 1031,1044 **** strcpy(tspace, apath); tp = strrchr(tspace, '\\'); if (tp) { ! *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */ } else { ! fs_ExtractDriveLetter(apath, tspace); strcat(tspace, "."); } ! return tspace; } BOOL MakeMount(const CString& strDir, const CString& strVolName, const CString& strCellName, BOOL bRW) --- 1031,1044 ---- strcpy(tspace, apath); tp = strrchr(tspace, '\\'); if (tp) { ! *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */ } else { ! fs_ExtractDriveLetter(apath, tspace); strcat(tspace, "."); } ! return tspace; } BOOL MakeMount(const CString& strDir, const CString& strVolName, const CString& strCellName, BOOL bRW) *************** *** 1048,1096 **** char localCellName[1000]; struct ViceIoctl blob; ! HOURGLASS hourglass; ! ASSERT(strVolName.GetLength() < 64); ! /* ! defect #3069 if (as->parms[5].items && !as->parms[2].items) { fprintf(stderr,"fs: must provide cell when creating cellular mount point.\n"); return FALSE; } ! */ if (strCellName.GetLength() > 0) /* cell name specified */ ! cellName = PCCHAR(strCellName); else ! cellName = (char *) 0; if (!IsPathInAfs(Parent(PCCHAR(strDir)))) { ! ShowMessageBox(IDS_MAKE_MP_NOT_AFS_ERROR, MB_ICONEXCLAMATION, IDS_MAKE_MP_NOT_AFS_ERROR); ! return FALSE; } if (cellName) { ! blob.in_size = 0; ! blob.out_size = MAXSIZE; ! blob.out = space; ! code = pioctl(Parent(PCCHAR(strDir)), VIOC_FILE_CELL_NAME, &blob, 1); ! } strcpy(localCellName, (cellName? cellName : space)); if (bRW) /* if -rw specified */ ! strcpy(space, "%"); else ! strcpy(space, "#"); /* If cellular mount point, prepend cell prefix */ ! if (cellName) { ! strcat(space, localCellName); ! strcat(space, ":"); ! } strcat(space, strVolName); /* append volume name */ strcat(space, "."); /* stupid convention; these end with a period */ --- 1048,1096 ---- char localCellName[1000]; struct ViceIoctl blob; ! HOURGLASS hourglass; ! ASSERT(strVolName.GetLength() < 64); ! /* ! defect #3069 if (as->parms[5].items && !as->parms[2].items) { fprintf(stderr,"fs: must provide cell when creating cellular mount point.\n"); return FALSE; } ! */ if (strCellName.GetLength() > 0) /* cell name specified */ ! cellName = PCCHAR(strCellName); else ! cellName = (char *) 0; if (!IsPathInAfs(Parent(PCCHAR(strDir)))) { ! ShowMessageBox(IDS_MAKE_MP_NOT_AFS_ERROR, MB_ICONEXCLAMATION, IDS_MAKE_MP_NOT_AFS_ERROR); ! return FALSE; } if (cellName) { ! blob.in_size = 0; ! blob.out_size = MAXSIZE; ! blob.out = space; ! code = pioctl(Parent(PCCHAR(strDir)), VIOC_FILE_CELL_NAME, &blob, 1); ! } strcpy(localCellName, (cellName? cellName : space)); if (bRW) /* if -rw specified */ ! strcpy(space, "%"); else ! strcpy(space, "#"); /* If cellular mount point, prepend cell prefix */ ! if (cellName) { ! strcat(space, localCellName); ! strcat(space, ":"); ! } strcat(space, strVolName); /* append volume name */ strcat(space, "."); /* stupid convention; these end with a period */ *************** *** 1105,1229 **** code = pioctl(PCCHAR(strDir), VIOC_AFS_CREATE_MT_PT, &blob, 0); if (code) { ! ShowMessageBox(IDS_MOUNT_POINT_ERROR, MB_ICONEXCLAMATION, IDS_MOUNT_POINT_ERROR, GetAfsError(errno, strDir)); ! return FALSE; } ! return TRUE; } /* */ long fs_ExtractDriveLetter(const char *inPathp, char *outPathp) { ! if (inPathp[0] != 0 && inPathp[1] == ':') { ! /* there is a drive letter */ ! *outPathp++ = *inPathp++; ! *outPathp++ = *inPathp++; ! *outPathp++ = 0; ! } ! else *outPathp = 0; ! return 0; ! } /* strip the drive letter from a component */ long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize) { ! char tempBuffer[1000]; ! strcpy(tempBuffer, inPathp); ! if (tempBuffer[0] != 0 && tempBuffer[1] == ':') { ! /* drive letter present */ ! strcpy(outPathp, tempBuffer+2); ! } ! else { ! /* no drive letter present */ ! strcpy(outPathp, tempBuffer); ! } ! return 0; ! } BOOL RemoveSymlink(const char * linkName) { ! BOOL error = FALSE; INT code=0; struct ViceIoctl blob; char tbuffer[1024]; char lsbuffer[1024]; ! char tpbuffer[1024]; char *tp; ! HOURGLASS hourglass; ! tp = (char *) strrchr(linkName, '\\'); ! if (!tp) ! tp = (char *) strrchr(linkName, '/'); ! if (tp) { ! strncpy(tbuffer, linkName, code=tp-linkName+1); /* the dir name */ ! tbuffer[code] = 0; ! tp++; /* skip the slash */ ! } ! else { ! fs_ExtractDriveLetter(linkName, tbuffer); ! strcat(tbuffer, "."); ! fs_StripDriveLetter(tp, tpbuffer, 0); ! tp=tpbuffer; ! } ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! blob.out = lsbuffer; ! blob.out_size = sizeof(lsbuffer); ! code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0); ! if (code) ! return FALSE; ! blob.out_size = 0; ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! return (pioctl(tbuffer, VIOC_DELSYMLINK, &blob, 0)==0); ! } BOOL IsSymlink(const char * true_name) { char parent_dir[MAXSIZE]; /*Parent directory of true name*/ ! char strip_name[MAXSIZE]; struct ViceIoctl blob; ! char *last_component; int code; HOURGLASS hourglass; ! last_component = (char *) strrchr(true_name, '\\'); ! if (!last_component) ! last_component = (char *) strrchr(true_name, '/'); ! if (last_component) { ! /* ! * Found it. Designate everything before it as the parent directory, ! * everything after it as the final component. ! */ ! strncpy(parent_dir, true_name, last_component - true_name + 1); ! parent_dir[last_component - true_name + 1] = 0; ! last_component++; /*Skip the slash*/ ! } ! else { ! /* ! * No slash appears in the given file name. Set parent_dir to the current ! * directory, and the last component as the given name. ! */ ! fs_ExtractDriveLetter(true_name, parent_dir); ! strcat(parent_dir, "."); ! last_component = strip_name; fs_StripDriveLetter(true_name, strip_name, sizeof(strip_name)); ! } ! blob.in = last_component; ! blob.in_size = strlen(last_component)+1; ! blob.out_size = MAXSIZE; ! blob.out = space; ! memset(space, 0, MAXSIZE); ! code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1); ! return (code==0); ! } /* --- 1105,1262 ---- code = pioctl(PCCHAR(strDir), VIOC_AFS_CREATE_MT_PT, &blob, 0); if (code) { ! ShowMessageBox(IDS_MOUNT_POINT_ERROR, MB_ICONEXCLAMATION, IDS_MOUNT_POINT_ERROR, GetAfsError(errno, strDir)); ! return FALSE; } ! return TRUE; } /* */ long fs_ExtractDriveLetter(const char *inPathp, char *outPathp) { ! if (inPathp[0] != 0 && inPathp[1] == ':') { ! /* there is a drive letter */ ! *outPathp++ = *inPathp++; ! *outPathp++ = *inPathp++; ! *outPathp++ = 0; ! } ! else *outPathp = 0; ! return 0; ! } /* strip the drive letter from a component */ long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize) { ! char tempBuffer[1000]; ! strcpy(tempBuffer, inPathp); ! if (tempBuffer[0] != 0 && tempBuffer[1] == ':') { ! /* drive letter present */ ! strcpy(outPathp, tempBuffer+2); ! } ! else { ! /* no drive letter present */ ! strcpy(outPathp, tempBuffer); ! } ! return 0; ! } BOOL RemoveSymlink(const char * linkName) { ! BOOL error = FALSE; INT code=0; struct ViceIoctl blob; char tbuffer[1024]; char lsbuffer[1024]; ! char tpbuffer[1024]; char *tp; ! HOURGLASS hourglass; ! tp = (char *) strrchr(linkName, '\\'); ! if (!tp) ! tp = (char *) strrchr(linkName, '/'); ! if (tp) { ! strncpy(tbuffer, linkName, code=tp-linkName+1); /* the dir name */ ! tbuffer[code] = 0; ! tp++; /* skip the slash */ ! } ! else { ! fs_ExtractDriveLetter(linkName, tbuffer); ! strcat(tbuffer, "."); ! fs_StripDriveLetter(tp, tpbuffer, 0); ! tp=tpbuffer; ! } ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! blob.out = lsbuffer; ! blob.out_size = sizeof(lsbuffer); ! code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0); ! if (code) ! return FALSE; ! blob.out_size = 0; ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! return (pioctl(tbuffer, VIOC_DELSYMLINK, &blob, 0)==0); ! } BOOL IsSymlink(const char * true_name) { char parent_dir[MAXSIZE]; /*Parent directory of true name*/ ! char strip_name[MAXSIZE]; struct ViceIoctl blob; ! char *last_component; int code; HOURGLASS hourglass; ! last_component = (char *) strrchr(true_name, '\\'); ! if (!last_component) ! last_component = (char *) strrchr(true_name, '/'); ! if (last_component) { ! /* ! * Found it. Designate everything before it as the parent directory, ! * everything after it as the final component. ! */ ! strncpy(parent_dir, true_name, last_component - true_name + 1); ! parent_dir[last_component - true_name + 1] = 0; ! last_component++; /*Skip the slash*/ ! } ! else { ! /* ! * No slash appears in the given file name. Set parent_dir to the current ! * directory, and the last component as the given name. ! */ ! fs_ExtractDriveLetter(true_name, parent_dir); ! strcat(parent_dir, "."); ! last_component = strip_name; fs_StripDriveLetter(true_name, strip_name, sizeof(strip_name)); ! } ! blob.in = last_component; ! blob.in_size = strlen(last_component)+1; ! blob.out_size = MAXSIZE; ! blob.out = space; ! memset(space, 0, MAXSIZE); ! code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1); ! return (code==0); ! } ! ! ! BOOL IsMountPoint(const char * name) ! { ! register LONG code = 0; ! struct ViceIoctl blob; ! char tbuffer[1024]; ! char lsbuffer[1024]; ! register char *tp; ! char szCurItem[1024]; ! strcpy(szCurItem, name); ! ! tp = (char *)strrchr(szCurItem, '\\'); ! if (tp) { ! strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1); /* the dir name */ ! tbuffer[code] = 0; ! tp++; /* skip the slash */ ! } else { ! fs_ExtractDriveLetter(szCurItem, tbuffer); ! strcat(tbuffer, "."); ! tp = szCurItem; ! fs_StripDriveLetter(tp, tp, 0); ! } ! ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! blob.out = lsbuffer; ! blob.out_size = sizeof(lsbuffer); ! ! code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0); ! ! return (code==0); ! } /* *************** *** 1239,1299 **** char tbuffer[1024]; char lsbuffer[1024]; register char *tp; ! BOOL error = FALSE; ! CStringArray results; ! CString str; ! CString str2; ! HOURGLASS hourglass; for (int i = 0; i < files.GetSize(); i++) { ! char szCurItem[1024]; ! strcpy(szCurItem, files[i]); ! ! tp = (char *)strrchr(szCurItem, '\\'); ! if (tp) { ! strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1); /* the dir name */ ! tbuffer[code] = 0; ! tp++; /* skip the slash */ ! } else { ! fs_ExtractDriveLetter(szCurItem, tbuffer); ! strcat(tbuffer, "."); ! tp = szCurItem; ! fs_StripDriveLetter(tp, tp, 0); ! } ! ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! blob.out = lsbuffer; ! blob.out_size = sizeof(lsbuffer); ! ! code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0); ! if (code) { ! error = TRUE; ! if (errno == EINVAL) ! results.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i]))); ! else ! results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i])))); ! continue; // don't bother trying ! } ! ! blob.out_size = 0; ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! ! code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0); ! if (code) { ! error = TRUE; ! results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i])))); ! } else ! results.Add(GetMessageString(IDS_DELETED)); ! } ! LoadString (str, IDS_REMOVE_MP); ! LoadString (str2, IDS_REMOVE_MP_COLUMN); ! CResultsDlg dlg(REMOVE_MOUNT_POINTS_HELP_ID); ! dlg.SetContents(str, str2, StripPath(files), results); ! dlg.DoModal(); return !error; } --- 1272,1311 ---- char tbuffer[1024]; char lsbuffer[1024]; register char *tp; ! BOOL error = FALSE; ! CStringArray results; ! CString str; ! CString str2; ! HOURGLASS hourglass; for (int i = 0; i < files.GetSize(); i++) { ! if (!IsMountPoint(files[i])) { ! error = TRUE; ! if (errno == EINVAL) ! results.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i]))); ! else ! results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i])))); ! continue; // don't bother trying ! } ! blob.out_size = 0; ! blob.in = tp; ! blob.in_size = strlen(tp)+1; ! ! code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0); ! if (code) { ! error = TRUE; ! results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i])))); ! } else ! results.Add(GetMessageString(IDS_DELETED)); ! } ! ! LoadString (str, IDS_REMOVE_MP); ! LoadString (str2, IDS_REMOVE_MP_COLUMN); ! CResultsDlg dlg(REMOVE_MOUNT_POINTS_HELP_ID); ! dlg.SetContents(str, str2, StripPath(files), results); ! dlg.DoModal(); return !error; } *************** *** 1305,1316 **** struct VolumeStatus *status; char *name; ! HOURGLASS hourglass; ! volInfo.m_strFilePath = strFile; volInfo.m_strFileName = StripPath(strFile); ! /* volInfo.m_strName = "VolumeName"; volInfo.m_nID = 10; volInfo.m_nQuota = 20 * 1024 * 1024; --- 1317,1328 ---- struct VolumeStatus *status; char *name; ! HOURGLASS hourglass; ! volInfo.m_strFilePath = strFile; volInfo.m_strFileName = StripPath(strFile); ! /* volInfo.m_strName = "VolumeName"; volInfo.m_nID = 10; volInfo.m_nQuota = 20 * 1024 * 1024; *************** *** 1320,1348 **** volInfo.m_nPartFree = 30 * 1024 * 1024; volInfo.m_nDup = -1; return TRUE; ! */ ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! ! code = pioctl(PCCHAR(strFile), VIOCGETVOLSTAT, &blob, 1); ! if (code) { ! volInfo.m_strErrorMsg = GetAfsError(errno, strFile); ! return FALSE; ! } ! ! status = (VolumeStatus *)space; ! name = (char *)status + sizeof(*status); ! ! volInfo.m_strName = name; ! volInfo.m_nID = status->Vid; ! volInfo.m_nQuota = status->MaxQuota; ! volInfo.m_nNewQuota = status->MaxQuota; ! volInfo.m_nUsed = status->BlocksInUse; ! volInfo.m_nPartSize = status->PartMaxBlocks; ! volInfo.m_nPartFree = status->PartBlocksAvail; ! volInfo.m_nDup = -1; return TRUE; } --- 1332,1360 ---- volInfo.m_nPartFree = 30 * 1024 * 1024; volInfo.m_nDup = -1; return TRUE; ! */ ! blob.out_size = MAXSIZE; ! blob.in_size = 0; ! blob.out = space; ! ! code = pioctl(PCCHAR(strFile), VIOCGETVOLSTAT, &blob, 1); ! if (code) { ! volInfo.m_strErrorMsg = GetAfsError(errno, strFile); ! return FALSE; ! } ! ! status = (VolumeStatus *)space; ! name = (char *)status + sizeof(*status); ! ! volInfo.m_strName = name; ! volInfo.m_nID = status->Vid; ! volInfo.m_nQuota = status->MaxQuota; ! volInfo.m_nNewQuota = status->MaxQuota; ! volInfo.m_nUsed = status->BlocksInUse; ! volInfo.m_nPartSize = status->PartMaxBlocks; ! volInfo.m_nPartFree = status->PartBlocksAvail; ! volInfo.m_nDup = -1; return TRUE; } *************** *** 1354,1402 **** struct VolumeStatus *status; char *input; ! HOURGLASS hourglass; ! blob.out_size = MAXSIZE; ! blob.in_size = sizeof(*status) + 3; /* for the three terminating nulls */ ! blob.out = space; ! blob.in = space; ! ! status = (VolumeStatus *)space; ! status->MinQuota = -1; ! status->MaxQuota = volInfo.m_nNewQuota; ! input = (char *)status + sizeof(*status); ! *(input++) = '\0'; /* never set name: this call doesn't change vldb */ ! *(input++) = '\0'; // No offmsg ! *(input++) = '\0'; // No motd #ifdef LOGGING_ON ! FILE *fp = OpenFile(szLogFileName, "a"); ! if (fp) { ! fprintf(fp, "\nSetVolInfo() pioctl parms:\n"); ! fprintf(fp, "\tpathp = %s\n\topcode = VIOCSETVOLSTAT (%d)\n\tblobp = %ld\n", PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob); ! fprintf(fp, "\t\tblobp.in = %ld (VolumeStatus *status)\n\t\tblobp.in_size = %ld\n\t\tblobp.out = %ld ((VolumeStatus *status))\n\t\tblobp.out_size = %ld\n", blob.in, blob.in_size, blob.out, blob.out_size); ! fprintf(fp, "\t\t\tstatus->MinQuota = %ld\n", status->MinQuota); ! fprintf(fp, "\t\t\tstatus->MaxQuota = %ld\n", status->MaxQuota); ! fprintf(fp, "\t\t\tOther status fields aren't set\n"); ! fprintf(fp, "\t\t\t3 nulls follow the VolumeStatus structure.\n"); ! fprintf(fp, "\tfollow = 1\n"); ! fclose(fp); ! } #endif ! code = pioctl(PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_SET_QUOTA_ERROR, MB_ICONEXCLAMATION, IDS_SET_QUOTA_ERROR, GetAfsError(errno, volInfo.m_strName)); ! return FALSE; ! } return TRUE; } int GetCellName(char *cellNamep, struct afsconf_cell *infop) { ! strcpy(infop->name, cellNamep); return 0; } --- 1366,1414 ---- struct VolumeStatus *status; char *input; ! HOURGLASS hourglass; ! blob.out_size = MAXSIZE; ! blob.in_size = sizeof(*status) + 3; /* for the three terminating nulls */ ! blob.out = space; ! blob.in = space; ! ! status = (VolumeStatus *)space; ! status->MinQuota = -1; ! status->MaxQuota = volInfo.m_nNewQuota; ! input = (char *)status + sizeof(*status); ! *(input++) = '\0'; /* never set name: this call doesn't change vldb */ ! *(input++) = '\0'; // No offmsg ! *(input++) = '\0'; // No motd #ifdef LOGGING_ON ! FILE *fp = OpenFile(szLogFileName, "a"); ! if (fp) { ! fprintf(fp, "\nSetVolInfo() pioctl parms:\n"); ! fprintf(fp, "\tpathp = %s\n\topcode = VIOCSETVOLSTAT (%d)\n\tblobp = %ld\n", PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob); ! fprintf(fp, "\t\tblobp.in = %ld (VolumeStatus *status)\n\t\tblobp.in_size = %ld\n\t\tblobp.out = %ld ((VolumeStatus *status))\n\t\tblobp.out_size = %ld\n", blob.in, blob.in_size, blob.out, blob.out_size); ! fprintf(fp, "\t\t\tstatus->MinQuota = %ld\n", status->MinQuota); ! fprintf(fp, "\t\t\tstatus->MaxQuota = %ld\n", status->MaxQuota); ! fprintf(fp, "\t\t\tOther status fields aren't set\n"); ! fprintf(fp, "\t\t\t3 nulls follow the VolumeStatus structure.\n"); ! fprintf(fp, "\tfollow = 1\n"); ! fclose(fp); ! } #endif ! code = pioctl(PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob, 1); ! if (code) { ! ShowMessageBox(IDS_SET_QUOTA_ERROR, MB_ICONEXCLAMATION, IDS_SET_QUOTA_ERROR, GetAfsError(errno, volInfo.m_strName)); ! return FALSE; ! } return TRUE; } int GetCellName(char *cellNamep, struct afsconf_cell *infop) { ! strcpy(infop->name, cellNamep); return 0; } *************** *** 1409,1415 **** struct afsconf_cell info; struct chservinfo checkserv; ! HOURGLASS hourglass; memset(&checkserv, 0, sizeof(struct chservinfo)); blob.in_size = sizeof(struct chservinfo); --- 1421,1427 ---- struct afsconf_cell info; struct chservinfo checkserv; ! HOURGLASS hourglass; memset(&checkserv, 0, sizeof(struct chservinfo)); blob.in_size = sizeof(struct chservinfo); *************** *** 1420,1646 **** memset(space, 0, sizeof(LONG)); /* so we assure zero when nothing is copied back */ /* prepare flags for checkservers command */ ! if (nCellsToCheck == LOCAL_CELL) ! temp = 2; /* default to checking local cell only */ else if (nCellsToCheck == ALL_CELLS) ! temp &= ~2; /* turn off local cell check */ ! if (bFast) ! temp |= 1; /* set fast flag */ checkserv.magic = 0x12345678; /* XXX */ checkserv.tflags = temp; /* now copy in optional cell name, if specified */ if (nCellsToCheck == SPECIFIC_CELL) { ! GetCellName(PCCHAR(strCellName), &info); ! strcpy(checkserv.tbuffer,info.name); ! checkserv.tsize = strlen(info.name) + 1; } else { ! strcpy(checkserv.tbuffer, "\0"); ! checkserv.tsize = 0; ! } ! checkserv.tinterval = -1; /* don't change current interval */ code = pioctl(0, VIOCCKSERV, &blob, 1); if (code) { ! ShowMessageBox(IDS_CHECK_SERVERS_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_SERVERS_ERROR, GetAfsError(errno, CString())); ! return FALSE; } memcpy(&temp, space, sizeof(LONG)); ! if (temp == 0) { ! ShowMessageBox(IDS_ALL_SERVERS_RUNNING, MB_OK, IDS_ALL_SERVERS_RUNNING); ! return TRUE; ! } ! ! CStringArray servers; ! for (j = 0; j < MAXHOSTS; j++) { ! memcpy(&temp, space + j * sizeof(LONG), sizeof(LONG)); ! if (temp == 0) ! break; ! ! char *name = hostutil_GetNameByINet(temp); ! servers.Add(name); ! } ! ! CDownServersDlg dlg; ! dlg.SetServerNames(servers); ! dlg.DoModal(); return TRUE; ! } BOOL GetTokenInfo(CStringArray& tokenInfo) { ! int cellNum; ! int rc; ! time_t current_time; ! time_t tokenExpireTime; ! char *expireString; ! char userName[100]; // char s[100]; ! struct ktc_principal serviceName, clientName; ! struct ktc_token token; ! ! CString strTokenInfo; ! CString strUserName; ! CString strCellName; ! CString strExpir; ! // tokenInfo.Add(""); // return TRUE; ! HOURGLASS hourglass; // printf("\nTokens held by the Cache Manager:\n\n"); ! cellNum = 0; ! current_time = time(0); ! while (1) { ! rc = ktc_ListTokens(cellNum, &cellNum, &serviceName); ! if (rc == KTC_NOENT) { ! /* end of list */ ! // printf(" --End of list --\n"); ! break; ! } ! else if (rc == KTC_NOCM) { ! ShowMessageBox(IDS_GET_TOKENS_NO_AFS_SERVICE); ! // printf("AFS service may not have started\n"); ! break; ! } ! else if (rc) { ! ShowMessageBox(IDS_GET_TOKENS_UNEXPECTED_ERROR, MB_ICONEXCLAMATI