Skip to content

Commit

Permalink
Close file objects when done
Browse files Browse the repository at this point in the history
  • Loading branch information
NuclearFizzler committed Dec 31, 2024
1 parent 5c7df82 commit f47cfc1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/GetNPUsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def run(self):
logging.info('Getting TGT for %s' % self.__username)
entry = self.getTGT(self.__username)
self.outputTGT(entry, fd)
if fd is not None:
fd.close()
return

# Connect to LDAP
Expand All @@ -280,7 +282,9 @@ def run(self):
# Cannot authenticate, we will try to get this users' TGT (hoping it has PreAuth disabled)
logging.info('Cannot authenticate %s, getting its TGT' % self.__username)
entry = self.getTGT(self.__username)
self.outputTGT(entry, fd)
self.outputTGT(entry, fd)
if fd is not None:
fd.close()
return


Expand Down

0 comments on commit f47cfc1

Please sign in to comment.