#397 GetNamedSecurityInfo crashes Python with SE_LMSHARE

win32 (141)
Tim Golden

This code causes Python to crash completely. Python 2.6; pywin32 212; Win XP SP3. Haven't looked at the source yet nor run it through the debugger.

import win32security
win32security.GetNamedSecurityInfo (


  • Roger Upole

    Roger Upole - 2008-12-06

    It appears the api function is returning NULL for the security descriptor
    even though the call completed successfully. Never seen this with any
    other type of securable object, or even a normal non-administrative
    share. Usually if there is no info to be returned, you'll get an empty
    security descriptor rather than null.

    Any preferences on how to handle this? We could
    a) raise an exception anyway
    b) return None
    c) construct and return an empty security descriptor to
    be consistent with how this function works everwhere else

  • Roger Upole

    Roger Upole - 2008-12-06
    • priority: 5 --> 9
    • assigned_to: nobody --> rupole
  • Roger Upole

    Roger Upole - 2008-12-06

    After looking at it for a while, I think returning None
    is the most appropriate thing to do. That way the caller
    will at least know that the security descriptor was NULL,
    as it may have some special significance that I'm not
    aware of.

  • Roger Upole

    Roger Upole - 2008-12-07
    • status: open --> closed-fixed
  • Roger Upole

    Roger Upole - 2008-12-07

    This is fixed in the main branch now.

  • Tim Golden

    Tim Golden - 2008-12-07

    Thanks very much for fixing this, Roger. I did umm and ahh a bit as to what the best approach would be (None, exception, etc.) but I do think any one answer is compelling and I'm happy with a None.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks