viraf@gwusun.gwu.edu (Viraf Bankwalla) (06/19/89)
Hi, Several people have been asking on how to prevent the chooser name from being changed. I too needed such a patch, and found it on Comp.sys.mac.programmer a few months ago. I have tried the patch, and it works. For those who want it, it follows below. viraf bankwalla viraf@gwusun.gwu.edu uunet!gwusun!viraf ---------------------------------------------- Some had ask how to prevent users from changing the name in the Chooser. I, too, have a use for this is a Macintosh cluster, where the Chooser name is used to record statistics on who is using the facility. The users have boot floppies and will mount AppleShare servers for most applications. We will probably use something like TrafficWatch from Farallon Computing to monitor users on the network. To requires that the Chooser name remain constant. I've figured out a way to do this. The Chooser name is stored in at 'STR ' (trailing space required) resource in the System file, id = -16096. AppleShare and RegisterName (also from Farallon) both look for this string id. What I did was to modify Chooser so it allows changing to a different 'STR ' resource, leaving the right intact. To do this: 1) Run Font/DA Mover to transfer the Chooser from the System file to a suitcase file. 2) Run Resedit, and open the suitcase file. See what id the 'DRVR' resource has (call this number N). Now calculate: I = 32 * N - 16382 (This is the resource id of resource #2, owned by 'DRVR' N). 3) Open the System file and copy 'STR ' resource id = -16096 to the suitcase file. 4) Change the resource id of this copied resource to I. Save and exit Resedit. 5) Run Fedit or similar file editor. Open the suitcase resource fork. 6) Search for all occurrences of hex string 'C120' and change it to the hex equivalent of value I, calculated in 2) above. There are 2 occurrences, fairly close together, in the same block. Save and exit. 7) Now use Font/DA Mover to delete the original Chooser in the System file and copy in the modified version. Now changes to the Chooser name (via Chooser itself) don't change what AppleShare uses as the default login name, nor the name used by RegisterName. Changing the name now requires Resedit, which is beyond the casual user. Note that since Chooser may have different id numbers in different System files, you may need to use different values for I. Also, a modified Chooser from one System may have a conflicting id for a different System, and Font/DA Mover will modify the id number and all resources owned by it. Then running Chooser will fail, since it has a hard coded resource number. Have fun and don't tell Apple I did this :-) Edward Moy Workstation Software Support Group University of California Berkeley, CA 94720 edmoy@violet.Berkeley.EDU ucbvax!violet!edmoy
tim@hoptoad.uucp (Tim Maroney) (06/21/89)
In article <1393@gwusun.gwu.edu> viraf@gwusun.gwu.edu (Viraf Bankwalla) writes: > >Now changes to the Chooser name (via Chooser itself) don't change what >AppleShare uses as the default login name, nor the name used by RegisterName. >Changing the name now requires Resedit, which is beyond the casual user. No, it only requires Font/DA Mover to install the real Chooser. It's not only easy, it's quite likely to happen when someone notices that your hacked Chooser is misbehaving. This is a Level I security approach. Remember that students tend to be both clever and mischievous. Anything below Level II actually encourages them to misbehave. Also, this patching approach ignores the fact that a DA should recompute its resource ids dynamically, so there is no guarantee that the resource id will appear in "unfolded" form within the DA code. Finally, if there are any other resources with the same ID, which is perfectly legal, your Fedit strategy just removed access to them. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934 "Jesus died for somebody's sins, but not mine." -- Patti Smith