Python Cookbook Edited by Alex Martelli, David Ascher This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated January 24, 2005 Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: [145] 2nd paragraph; The second paragraph reads: The file patterns are case-insensitive The is only true if your os handles files this way. See the docs on fnmatch: http://www.python.org/doc/current/lib/module-fnmatch.html To get case-insensitivity on UNIX, you need the pattern '*.html' to be '*.[hH][tT][mM][lL]' Python 2.2.2/Solaris [257] 7.13 Impersonating Principles on Windows; The code detailed within is problematic. It will work only if certain criteria is met first. This presents a problem if the end user wants to use it on locked down NT based system (Win2k and XP). I spent several days on the Python-List requesting help and from Mark Hammond. Finally after someone pointed out the possibility I needed the below right first, was I able to make this function work. I have sent this comment to Active-State on this code and to you all as well so someone will not have to pull their hair out as I have done trying to get it to work. It is a VERY useful routine for our remote locations to install printer drivers or vendor supplied programs and is now working great. Please add an addendum so others will not have to go through the same basic research again to discover how to get it to work on a locked down system. In order to use it on these systems, one base requirement MUST be met. The "Act as Operating System" privilege has to enabled in the system policy(run secpol.msc, select Local Policies, User Rights Assignments). Once this is set, then the programmer needs to add some additional code and call it prior to attempting to login as the impersonated user. Example: def AdjustPrivilege(priv, enable = 1): # Get the process token. print priv flags = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY #flags= TOKEN_QUERY htoken = win32security.OpenProcessToken(win32api.GetCurrentProcess(), flags) # Get the ID for the privilege. id = win32security.LookupPrivilegeValue(None, priv) # Now obtain the privilege for this process. # Create a list of the privileges to be added. if enable: newPrivileges = [(id, SE_PRIVILEGE_ENABLED)] else: newPrivileges = [(id, 0)] # and make the adjustment. try: win32security.AdjustTokenPrivileges(htoken, 0, newPrivileges) except: fail.append(priv) # call routine to set privileges. This goes after the call to main. AdjustPrivilege(SE_CHANGE_NOTIFY_NAME) AdjustPrivilege(SE_TCB_NAME) AdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_NAME) # Then the login try: a.login EDITOR: The reporter is correct. (378) The Xerox PARC Map Viewer Service (http://pubweb.parc.xerox.com/) used in this recipe is no longer maintained.